Skip to content

Commit

Permalink
Feriennet: Fix bug when there is no prebooking phase
Browse files Browse the repository at this point in the history
TYPE: Bugfix
LINK: PRO-1296
  • Loading branch information
BreathingFlesh authored Jul 9, 2024
1 parent 7412046 commit c4fe859
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/onegov/activity/collections/period.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def model_class(self) -> type[Period]:
def add( # type:ignore[override]
self,
title: str,
prebooking: tuple['date', 'date'],
prebooking: tuple['date | None', 'date | None'],
booking: tuple['date', 'date'],
execution: tuple['date', 'date'],
active: bool = False,
Expand Down
2 changes: 1 addition & 1 deletion src/onegov/feriennet/templates/period_form.pt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</tal:b>
<div class="row">
<div class="small-12 medium-7 large-5 columns">
<div metal:use-macro="layout.macros['form']" />
<div metal:use-macro="layout.macros['form']" tal:define="form_id 'main-form'"/>
</div>
</div>
</tal:b>
Expand Down
3 changes: 2 additions & 1 deletion src/onegov/feriennet/views/period.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ def new_period(
assert form.title.data is not None
# NOTE: We can't put these assertions into the properties, because
# they need to be optional for the tests to pass
assert is_date_range(form.prebooking)
if form.prebooking != (None, None):
assert is_date_range(form.prebooking)
assert is_date_range(form.booking)
assert is_date_range(form.execution)
period = self.add(
Expand Down

0 comments on commit c4fe859

Please sign in to comment.