Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Age Config Defaults and Operation #4444

Merged
merged 3 commits into from
Feb 9, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions uber/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1525,6 +1525,7 @@ def _unrepr(d):
for _name, _section in _config['age_groups'].items():
_val = getattr(c, _name.upper())
c.AGE_GROUP_CONFIGS[_val] = dict(_section.dict(), val=_val)
c.AGE_GROUP_OPTS = [(key, value['desc']) for key,value in c.AGE_GROUP_CONFIGS.items()]

c.RECEIPT_DEPT_CATEGORIES = {}
for _name, _val in _config['enums']['receipt_item_dept'].items():
Expand Down
24 changes: 22 additions & 2 deletions uber/configspec.ini
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ shift_custom_badges = boolean(default=True)
# is turned on, then all registration forms will display and collect the exact
# birthdate. Turning this off will simply display a drop-down selection of the age
# groups defined below.
collect_exact_birthdate = boolean(default=False)
collect_exact_birthdate = boolean(default=True)

# Certain events need attendees' full addresses - others will only want some
# information. If this is turned off, attendees are only asked for their zipcode,
Expand Down Expand Up @@ -1392,7 +1392,7 @@ can_volunteer = boolean(default=True)
consent_form = boolean(default=False)

[[under_13]]
Copy link
Member

Choose a reason for hiding this comment

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

Let's simplify these a bit more, since not all conventions have the under-13/over-13 distinction, and just do two age groups: under 18 and 18 and up. The wristband color can be red vs green and the under-18 group should have volunteering turned off and the consent form turned on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

desc = string(default="Between 6 and 13")
desc = string(default="Between 6 and 12")
min_age = integer(default=6)
Copy link
Member

Choose a reason for hiding this comment

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

Min age should be 0 here so people under 6 don't get sorted into "age unknown"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed. i didnt realize there wasn't a min age config elsewhere

max_age = integer(default=12)
wristband_color = string(default="red")
Expand All @@ -1401,6 +1401,26 @@ can_register = boolean(default=True)
can_volunteer = boolean(default=False)
consent_form = boolean(default=True)

[[13_to_17]]
desc = string(default="Between 13 and 17")
min_age = integer(default=13)
max_age = integer(default=17)
wristband_color = string(default="yellow")
discount = integer(default=0)
can_register = boolean(default=True)
can_volunteer = boolean(default=False)
consent_form = boolean(default=True)

[[over_17]]
desc = string(default="18 and older")
min_age = integer(default=18)
max_age = integer(default=120)
wristband_color = string(default="green")
discount = integer(default=0)
can_register = boolean(default=True)
can_volunteer = boolean(default=True)
consent_form = boolean(default=True)

[[__many__]]
desc = string
min_age = integer
Expand Down
2 changes: 1 addition & 1 deletion uber/forms/attendee.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class PersonalInfo(AddressForm, MagForm):
else validators.Optional()])
age_group = SelectField('Age Group', validators=[
validators.DataRequired("Please select your age group.") if not c.COLLECT_EXACT_BIRTHDATE
else validators.Optional()], choices=c.AGE_GROUPS)
else validators.Optional()], choices=c.AGE_GROUP_OPTS)
ec_name = StringField('Emergency Contact Name', validators=[
validators.DataRequired("Please tell us the name of your emergency contact.")
], render_kw={'placeholder': 'Who we should contact if something happens to you'})
Expand Down
2 changes: 1 addition & 1 deletion uber/templates/forms/attendee/personal_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
{% if c.COLLECT_EXACT_BIRTHDATE %}
{{ form_macros.form_input(personal_info.birthdate, admin_text=attendee.age_group_conf.desc) }}
{% else %}
TBD
{{ form_macros.form_input(personal_info.age_group) }}
{% endif %}
</div>

Expand Down
2 changes: 1 addition & 1 deletion uber/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def get_age_conf_from_birthday(birthdate, today=None):
age = get_age_from_birthday(birthdate, today)

for val, age_group in c.AGE_GROUP_CONFIGS.items():
if val != c.AGE_UNKNOWN and age_group['min_age'] <= age and age <= age_group['max_age']:
if val != c.AGE_UNKNOWN and age_group['min_age'] <= age <= age_group['max_age']:
return age_group

return c.AGE_GROUP_CONFIGS[c.AGE_UNKNOWN]
Expand Down
Loading