From 6d6038a9cdf06f929ca89b9996d4f311d0f34a06 Mon Sep 17 00:00:00 2001 From: hdaws Date: Thu, 6 Feb 2025 22:50:47 -0500 Subject: [PATCH] quasi working config...need to fix defaults and remove debug --- uber/config.py | 1 + uber/configspec.ini | 2 +- uber/forms/attendee.py | 2 +- uber/models/attendee.py | 4 ++++ uber/receipt_items.py | 2 ++ uber/templates/forms/attendee.html | 4 +++- uber/templates/forms/attendee/personal_info.html | 2 +- uber/templates/registration/index_base.html | 2 +- uber/utils.py | 6 +++++- 9 files changed, 19 insertions(+), 6 deletions(-) diff --git a/uber/config.py b/uber/config.py index 2ea29f516..5fcd629a7 100644 --- a/uber/config.py +++ b/uber/config.py @@ -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(): diff --git a/uber/configspec.ini b/uber/configspec.ini index 8df2f6409..66bef8cc0 100644 --- a/uber/configspec.ini +++ b/uber/configspec.ini @@ -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, diff --git a/uber/forms/attendee.py b/uber/forms/attendee.py index e574cd468..06515fcd1 100644 --- a/uber/forms/attendee.py +++ b/uber/forms/attendee.py @@ -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'}) diff --git a/uber/models/attendee.py b/uber/models/attendee.py index 151599679..93ac7f4d7 100644 --- a/uber/models/attendee.py +++ b/uber/models/attendee.py @@ -950,17 +950,21 @@ def promo_code_code(self): @property def age_discount(self): + print(f"HMD calculating age discount on attendee") # We dynamically calculate the age discount to be half the # current badge price. If for some reason the default discount # (if it exists) is greater than half off, we use that instead. + print(f"HMD age now or at con {self.age_now_or_at_con}") if self.age_now_or_at_con and self.age_now_or_at_con < 13: half_off = math.ceil(self.new_badge_cost / 2) if not self.age_group_conf['discount'] or self.age_group_conf['discount'] < half_off: return -half_off + print(f"HMD did not trigger under thirteen.... returning self age group conf discount") return -self.age_group_conf['discount'] @property def age_group_conf(self): + print(f"HMD calling age_group_conf on attendee") return get_age_conf_from_birthday(self.birthdate, c.NOW_OR_AT_CON) @property diff --git a/uber/receipt_items.py b/uber/receipt_items.py index 909118f19..c6034fc08 100644 --- a/uber/receipt_items.py +++ b/uber/receipt_items.py @@ -390,6 +390,8 @@ def badge_comp_credit(attendee, new_attendee=None): @receipt_calculation.Attendee def age_discount_credit(attendee, new_attendee=None): + print("HMD DEBUG IN age_discount_credit") + print(f"HMD DEBUG in age_discount_credit {attendee.age_discount}") if not new_attendee and (not attendee.qualifies_for_discounts or not attendee.age_discount): return elif not new_attendee: diff --git a/uber/templates/forms/attendee.html b/uber/templates/forms/attendee.html index d6578ae53..f8048ad9d 100644 --- a/uber/templates/forms/attendee.html +++ b/uber/templates/forms/attendee.html @@ -990,6 +990,8 @@

{{ tier.name }}

{% if not c.COLLECT_EXACT_BIRTHDATE or full_read or c.SECURITY_ADMIN_ACCESS %} +
HMD DEBUG
+
{{ c.AGE_GROUP_CONFIGS|jsonize }}
{% set age %} {% set read_only = age_ro or page_ro %}