Skip to content

Commit

Permalink
Only apply child badge validations to new attendees
Browse files Browse the repository at this point in the history
These validations are built solely for the prereg page , so we now ignore them for any attendee that isn't new or pending.
  • Loading branch information
kitsuta committed Sep 25, 2023
1 parent f34de14 commit 01635cd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions uber/model_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -975,13 +975,19 @@ def child_group_leaders(attendee):

@prereg_validation.Attendee
def no_more_child_badges(attendee):
if not attendee.is_new and not attendee.badge_status == c.PENDING_STATUS:
return

if c.CHILD_BADGE in c.PREREG_BADGE_TYPES and attendee.birthdate and \
get_age_from_birthday(attendee.birthdate, c.NOW_OR_AT_CON) < 18 and not c.CHILD_BADGE_AVAILABLE:
return ('badge_type', "Unfortunately, we are sold out of badges for attendees under 18.")


@prereg_validation.Attendee
def child_badge_over_13(attendee):
if not attendee.is_new and not attendee.badge_status == c.PENDING_STATUS:
return

if c.CHILD_BADGE in c.PREREG_BADGE_TYPES and attendee.birthdate and attendee.badge_type == c.CHILD_BADGE \
and get_age_from_birthday(attendee.birthdate, c.NOW_OR_AT_CON) >= 13:
return ('badge_type', "If you will be 13 or older at the start of {}, " \
Expand All @@ -990,6 +996,9 @@ def child_badge_over_13(attendee):

@prereg_validation.Attendee
def attendee_badge_under_13(attendee):
if not attendee.is_new and not attendee.badge_status == c.PENDING_STATUS:
return

if c.CHILD_BADGE in c.PREREG_BADGE_TYPES and attendee.birthdate and attendee.badge_type == c.ATTENDEE_BADGE \
and get_age_from_birthday(attendee.birthdate, c.NOW_OR_AT_CON) < 13:
return ('badge_type', "If you will be 12 or younger at the start of {}, " \
Expand Down

0 comments on commit 01635cd

Please sign in to comment.