Skip to content

Commit

Permalink
fix events.is_new_version when translations are None
Browse files Browse the repository at this point in the history
SDCP-794 SDCP-795
  • Loading branch information
petrjasek committed Jul 9, 2024
1 parent 800c47b commit f907a49
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion server/planning/events/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def get_subject_str(subject: Dict[str, str]) -> str:
subject.get("name", ""),
subject.get("qcode", ""),
subject.get("scheme", ""),
subject.get("translations", ""),
str(subject.get("translations", "")),
]
)

Expand Down
10 changes: 10 additions & 0 deletions server/planning/tests/events_service_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ def test_is_new_version():

assert service.is_new_version(new_event, old_event)

new_event["subject"] = [{"qcode": "foo", "name": "foo", "translations": {"fr-CA": "Foo"}}]
old_event["subject"] = [{"qcode": "foo", "name": "foo", "translations": None}]

assert service.is_new_version(new_event, old_event)

new_event["subject"] = [{"qcode": "foo", "name": "foo", "translations": {"fr-CA": "Bar"}}]
old_event["subject"] = [{"qcode": "foo", "name": "foo", "translations": {"fr-CA": "Foo"}}]

assert service.is_new_version(new_event, old_event)


def test_should_update():
service = EventsService()
Expand Down

0 comments on commit f907a49

Please sign in to comment.