From a02ffc773d8e4fe9ad82ae285a7775c3deca8dca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laur=C3=A9line=20Gu=C3=A9rin?= Date: Tue, 12 Jul 2022 15:45:56 +0200 Subject: [PATCH] caluire-axel: add activity_id in set_agenda changes result (#67280) --- passerelle/contrib/caluire_axel/models.py | 8 +++++++- tests/test_caluire_axel.py | 12 ++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/passerelle/contrib/caluire_axel/models.py b/passerelle/contrib/caluire_axel/models.py index a7c0df6d..e3489069 100644 --- a/passerelle/contrib/caluire_axel/models.py +++ b/passerelle/contrib/caluire_axel/models.py @@ -908,7 +908,13 @@ class CaluireAxel(BaseResource): updated = sorted(updated, key=itemgetter(0, 1, 2)) updated = [u for b, a, d, u in updated] updated = [ - {'booked': u['booked'], 'activity_label': u['activity_label'], 'day': u['day']} for u in updated + { + 'booked': u['booked'], + 'activity_id': u['activity_id'], + 'activity_label': u['activity_label'], + 'day': u['day'], + } + for u in updated ] return { diff --git a/tests/test_caluire_axel.py b/tests/test_caluire_axel.py index 6daa37c6..f038e0d3 100644 --- a/tests/test_caluire_axel.py +++ b/tests/test_caluire_axel.py @@ -2028,12 +2028,12 @@ def test_set_agenda_endpoint_multi(app, resource, family_data, booking_params): assert resp.json['updated'] is True assert resp.json['count'] == 6 assert resp.json['changes'] == [ - {'activity_label': 'Matin', 'day': '2020-09-07', 'booked': True}, - {'activity_label': 'Matin', 'day': '2020-09-08', 'booked': True}, - {'activity_label': 'Cantine', 'day': '2020-09-07', 'booked': True}, - {'activity_label': 'Matin', 'day': '2020-09-10', 'booked': False}, - {'activity_label': 'Matin', 'day': '2020-09-11', 'booked': False}, - {'activity_label': 'Cantine', 'day': '2020-09-11', 'booked': False}, + {'activity_id': 'ACCMAT', 'activity_label': 'Matin', 'day': '2020-09-07', 'booked': True}, + {'activity_id': 'ACCMAT', 'activity_label': 'Matin', 'day': '2020-09-08', 'booked': True}, + {'activity_id': 'ECOLELEM', 'activity_label': 'Cantine', 'day': '2020-09-07', 'booked': True}, + {'activity_id': 'ACCMAT', 'activity_label': 'Matin', 'day': '2020-09-10', 'booked': False}, + {'activity_id': 'ACCMAT', 'activity_label': 'Matin', 'day': '2020-09-11', 'booked': False}, + {'activity_id': 'ECOLELEM', 'activity_label': 'Cantine', 'day': '2020-09-11', 'booked': False}, ] assert len(operation.call_args_list) == 2