Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/ephios/core/signup/flow/participant_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,7 @@ def can_customize_signup(self):
self.participation is not None and self.participation.is_in_positive_state()
)

if positive_state:
# If in a positive state, check that you can decline and then sign up again.
return self.can_decline() and not self.get_signup_errors()
return not self.get_signup_errors()
return positive_state or not self.get_signup_errors()


class BasicSignupActionValidator(BaseSignupActionValidator):
Expand Down
16 changes: 13 additions & 3 deletions src/ephios/core/signup/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,19 @@ def __init__(self, *args, **kwargs):
FormActions(*self._get_buttons()),
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got a bit complex, we could also move that over to the validator e.g. as can_change_individual_times()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to see that in the validator in case we introduce API-based signup, yes.

Alternatively, have you thought about replacing can_customize_signup as a can_change_individual_time and just always allowing people to open the customize form (if they can sign up or decline)?

if not getattr(
self.shift.signup_flow.configuration, "user_can_customize_signup_times", False
):
validator = self.instance and self.shift.signup_flow.get_validator(
self.instance.participant
)
can_customize_times = (
validator
and (not self.instance.is_in_positive_state() or validator.can_decline())
and not validator.get_signup_errors()
)
if (
not getattr(
self.shift.signup_flow.configuration, "user_can_customize_signup_times", False
)
) or not can_customize_times:
self.fields["individual_start_time"].disabled = True
self.fields["individual_end_time"].disabled = True

Expand Down
Loading