Skip to content

Commit

Permalink
feat!: Change "day" type in week_table
Browse files Browse the repository at this point in the history
  • Loading branch information
mamico committed Jul 5, 2023
1 parent 5db0a63 commit cca7b49
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
6 changes: 3 additions & 3 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ Changelog
=========


2.0.0 (unreleased)
2.0.0.dev3 (unreleased)
------------------

- Nothing changed yet.

- Change "day" type in week_table (TODO: need an upgrade step?)
[mauro]

2.0.0.dev2 (2023-06-30)
-----------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ def get_pauses_in_day_folder(self, booking_date):
"""
weekday = booking_date.weekday()
pause_table = self.context.pause_table or []
today_pauses = [row for row in pause_table if row["day"] == weekday]
today_pauses = [row for row in pause_table if row["day"] == str(weekday)]
pauses = []
if today_pauses:
for pause in today_pauses:
Expand Down
21 changes: 12 additions & 9 deletions src/redturtle/prenotazioni/content/prenotazioni_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,12 @@ def get_from_form(form, fieldname):

class IWeekTableRow(model.Schema):
day = schema.TextLine(
title=_("day_label", default="Day of week"), required=True, default=""
title=_("day_label", default="Day of week"), required=True, default="",
)
form.mode(day="display")
# TODO: sarebbe bello, ma datagrid non funziona:
# su plone si rompe, su volto non considera il mode=display
# ancora peggio readonly=true sul field
# form.mode(day="display")
morning_start = schema.Choice(
title=_("morning_start_label", default="Start time in the morning"),
vocabulary="redturtle.prenotazioni.VocOreInizio",
Expand Down Expand Up @@ -98,13 +101,13 @@ class IPauseTableRow(model.Schema):
vocabulary=SimpleVocabulary(
[
SimpleTerm(value=None, token=None, title=_("Select a day")),
SimpleTerm(value=0, token=0, title=_("Monday")),
SimpleTerm(value=1, token=1, title=_("Tuesday")),
SimpleTerm(value=2, token=2, title=_("Wednesday")),
SimpleTerm(value=3, token=3, title=_("Thursday")),
SimpleTerm(value=4, token=4, title=_("Friday")),
SimpleTerm(value=5, token=5, title=_("Saturday")),
SimpleTerm(value=6, token=6, title=_("Sunday")),
SimpleTerm(value="0", token="0", title=_("Monday")),
SimpleTerm(value="1", token="1", title=_("Tuesday")),
SimpleTerm(value="2", token="2", title=_("Wednesday")),
SimpleTerm(value="3", token="3", title=_("Thursday")),
SimpleTerm(value="4", token="4", title=_("Friday")),
SimpleTerm(value="5", token="5", title=_("Saturday")),
SimpleTerm(value="6", token="6", title=_("Sunday")),
]
),
)
Expand Down

0 comments on commit cca7b49

Please sign in to comment.