Skip to content

Commit

Permalink
Merge f26b575 into 3b4705e
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmiller authored Apr 9, 2020
2 parents 3b4705e + f26b575 commit da022cf
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion elcid/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def update_from_dict(self, data, *args, **kwargs):
microbiology_input_id=self.id
)
icu_round.update_from_dict(
self.episode, data["when"], micro_input_icu_round_relation, *args, **kwargs
self.episode, data.get("when"), micro_input_icu_round_relation, *args, **kwargs
)
return result
else:
Expand Down
24 changes: 24 additions & 0 deletions elcid/test/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,30 @@ def test_update_from_dict_create_micro_relation(self):
emodels.ICURound.objects.get().id
)

def test_update_from_dict_without_when(self):
update_dict = {
'initials': 'FJK',
'infection_control': 'asdf',
'clinical_discussion': 'asdf',
'reason_for_interaction': 'ICU round',
'micro_input_icu_round_relation': {
'observation': {'temperature': 1111},
'icu_round': {}
},
'episode_id': self.episode.id
}
micro_input = emodels.MicrobiologyInput(
episode=self.episode
)
micro_input.update_from_dict(update_dict, self.user)

# refesh from database
micro_input = self.episode.microbiologyinput_set.get()

self.assertEqual(None, micro_input.when)
self.assertEqual(None, micro_input.microinputicuroundrelation.icu_round.when)


def test_update_from_dict_micro_relation(self):
micro_input = emodels.MicrobiologyInput.objects.create(
episode=self.episode
Expand Down

0 comments on commit da022cf

Please sign in to comment.