diff --git a/server/planning/events/events.py b/server/planning/events/events.py index 5364251cb..b6f41bbc3 100644 --- a/server/planning/events/events.py +++ b/server/planning/events/events.py @@ -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", "")), ] ) diff --git a/server/planning/tests/events_service_test.py b/server/planning/tests/events_service_test.py index 9dce29300..77cc09a1a 100644 --- a/server/planning/tests/events_service_test.py +++ b/server/planning/tests/events_service_test.py @@ -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()