Skip to content

Commit b0967d9

Browse files
norawlhenrikhorluck
andcommitted
Fix attendee extras logic
The check should be the opposite of the check in templates/events/details.html Co-authored-by: Henrik Hørlück Berg <[email protected]> Fix attendee extras logic The check should be the opposite of the check in templates/events/details.html Co-authored-by: Henrik Hørlück Berg <[email protected]>
1 parent 1d43829 commit b0967d9

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

apps/events/api/serializers.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,10 @@ def validate_extras(self, extra):
168168
if self.instance:
169169
attendance: AttendanceEvent = self.instance.event
170170
allowedExtras = Extras.objects.filter(attendanceevent=attendance)
171+
now = timezone.now()
171172

172-
if timezone.now() > attendance.registration_end:
173-
raise serializers.ValidationError(
174-
"Det er ikke mulig å endre ekstravalg etter påmeldingsfristen"
175-
)
176-
if timezone.now() > attendance.unattend_deadline:
177-
raise serializers.ValidationError(
178-
"Det er ikke mulig å endre ekstravalg etter avmeldingsfristen"
179-
)
173+
if now > attendance.unattend_deadline and attendance.registration_end < now:
174+
raise serializers.ValidationError("Du kan ikke lenger endre påmelding")
180175

181176
if extra and extra not in allowedExtras:
182177
raise serializers.ValidationError(

0 commit comments

Comments
 (0)