Skip to content

Commit

Permalink
Merge pull request #3144 from dotkom/fix/extras
Browse files Browse the repository at this point in the history
Fix attendee extras logic
  • Loading branch information
henrikhorluck authored Mar 16, 2024
2 parents 1d43829 + b0967d9 commit 69d9c91
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions apps/events/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,10 @@ def validate_extras(self, extra):
if self.instance:
attendance: AttendanceEvent = self.instance.event
allowedExtras = Extras.objects.filter(attendanceevent=attendance)
now = timezone.now()

if timezone.now() > attendance.registration_end:
raise serializers.ValidationError(
"Det er ikke mulig å endre ekstravalg etter påmeldingsfristen"
)
if timezone.now() > attendance.unattend_deadline:
raise serializers.ValidationError(
"Det er ikke mulig å endre ekstravalg etter avmeldingsfristen"
)
if now > attendance.unattend_deadline and attendance.registration_end < now:
raise serializers.ValidationError("Du kan ikke lenger endre påmelding")

if extra and extra not in allowedExtras:
raise serializers.ValidationError(
Expand Down

0 comments on commit 69d9c91

Please sign in to comment.