Skip to content

Commit

Permalink
WEB-4052 : If no schedule so we set "table_date" to None instead of []
Browse files Browse the repository at this point in the history
  • Loading branch information
boulch committed Jan 17, 2024
1 parent 90f9b0b commit 09cd049
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Changelog
1.2.4 (unreleased)
------------------

- Nothing changed yet.
- WEB-4052 : If no schedule so we set "table_date" to None instead of []
[boulch]


1.2.3 (2024-01-09)
Expand Down
7 changes: 4 additions & 3 deletions src/imio/directory/core/contents/contact/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ def __call__(self, version=None, include_items=True):
result["schedule_for_today"] = contact_prop.get_schedule_for_today(
opening_informations
)
result["table_date"] = []
week_days = contact_prop.get_week_days()
result["table_date"] = None
table_date = []
week_days = contact_prop.get_week_days()
day_mapping = {
"weekday_mon_short": "Monday",
"weekday_tue_short": "Tuesday",
Expand All @@ -53,7 +53,8 @@ def __call__(self, version=None, include_items=True):
day = day_mapping.get([k for k, v in a_date.items()][0])
dict = {day: formatted_schedule}
table_date.append(dict)
result["table_date"] = table_date
if len(table_date) > 0:
result["table_date"] = table_date

if lang and lang != "fr":
result["title"] = getattr(obj, f"title_{lang}")
Expand Down

0 comments on commit 09cd049

Please sign in to comment.