SCCapstone / DBK

0 stars 0 forks source link

Calculator View does not populate from selected job #49

Closed hxtk closed 5 years ago

hxtk commented 5 years ago

Pending acceptance of #44, the calculator view receives a null Job object and is therefore unable to populate or update it.

A complete resolution of this bug should involve a test suite with one unit test that fetches the Selected Job and verifies that it is not null, and a second unit test that attempts to update the job and ensures that it goes smoothly.

hxtk commented 5 years ago

As part of the bugfix that closed #45, it is now guaranteed that SettingsModel.getSettings().getValue() is always non-null, so it can be safely called at onCreate in CalculatorFragment. Also, it is not necessary for CalculatorFragment to observe the selected job as it is the only object making changes to it.

Thus, an approach would be to make SelectedJobModel.getSelectedJob().getValue() observe the same non-null guarantee so that it can be fetched synchronously in CalculatorFragment.onCreate(). The fields can then be populated from its SiteInfo.