Skip to content

Commit

Permalink
Don't assume the client sends a 'when' key when saving MicrobiologyInput
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmiller committed Apr 9, 2020
1 parent 9fb9851 commit f26b575
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
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
3 changes: 1 addition & 2 deletions elcid/test/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ def test_update_from_dict_create_micro_relation(self):

def test_update_from_dict_without_when(self):
update_dict = {
'when': '27/03/2020 09:33:55',
'initials': 'FJK',
'infection_control': 'asdf',
'clinical_discussion': 'asdf',
Expand All @@ -279,7 +278,7 @@ def test_update_from_dict_without_when(self):
micro_input = self.episode.microbiologyinput_set.get()

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


def test_update_from_dict_micro_relation(self):
Expand Down

0 comments on commit f26b575

Please sign in to comment.