Skip to content

Commit

Permalink
Fixed unittest issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ihor-palii committed Aug 9, 2024
1 parent 136c5bd commit 572455e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions temba/schedules/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ def clean(self):
repeat_period = cleaned_data.get("repeat_period")
repeat_days_of_week = cleaned_data.get("repeat_days_of_week")

if not self.is_valid():
return cleaned_data

if repeat_period == Schedule.REPEAT_WEEKLY and not repeat_days_of_week:
self.add_error("repeat_days_of_week", _("Must specify at least one day of the week."))
return cleaned_data

flow = cleaned_data.get("flow")
contacts = cleaned_data.get("contacts", [])
groups = cleaned_data.get("groups", [])
Expand Down Expand Up @@ -91,10 +98,6 @@ def clean(self):
if conflicts.count() > 0:
raise forms.ValidationError(_("There already exists a trigger of this type with these options."))

if self.is_valid():
if cleaned_data["repeat_period"] == Schedule.REPEAT_WEEKLY and not cleaned_data.get("repeat_days_of_week"):
self.add_error("repeat_days_of_week", _("Must specify at least one day of the week."))

return cleaned_data

class Meta:
Expand Down

0 comments on commit 572455e

Please sign in to comment.