Skip to content

Commit

Permalink
Fix form bugs with staff shirts
Browse files Browse the repository at this point in the history
In some cases, SHIRT_OPTS and STAFF_SHIRT_OPTS would be erroneously considered different from each other due to sorting. Additionally, in cases where the staff shirt and shirt opts were the same but all staff get a shirt, the form would hide the shirt size option. This fixes both issues.
  • Loading branch information
kitsuta committed May 16, 2024
1 parent 20441ff commit 27ec000
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions uber/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1528,6 +1528,7 @@ def _unrepr(d):
c.PREREG_SHIRT_OPTS = sorted(c.PREREG_SHIRT_OPTS if c.PREREG_SHIRT_OPTS else c.SHIRT_OPTS)[1:]
c.PREREG_SHIRTS = {key: val for key, val in c.PREREG_SHIRT_OPTS}
c.STAFF_SHIRT_OPTS = sorted(c.STAFF_SHIRT_OPTS if len(c.STAFF_SHIRT_OPTS) > 1 else c.SHIRT_OPTS)
c.SHIRT_OPTS = sorted(c.SHIRT_OPTS)
c.MERCH_SHIRT_OPTS = [(c.SIZE_UNKNOWN, 'select a size')] + sorted(list(c.SHIRT_OPTS))
c.MERCH_STAFF_SHIRT_OPTS = [(c.SIZE_UNKNOWN, 'select a size')] + sorted(list(c.STAFF_SHIRT_OPTS))
shirt_label_lookup = {val: key for key, val in c.SHIRT_OPTS}
Expand Down
8 changes: 5 additions & 3 deletions uber/templates/forms/attendee/badge_extras.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@
attendee.available_amount_extra_opts, disabled_opts=c.SOLD_OUT_MERCH_TIERS,
target_field_id=id_upgrade_prepend ~ "amount_extra") }}
</div>
{{ form_macros.toggle_fields_js(badge_extras.amount_extra, [badge_extras.shirt], off_values=["0"], toggle_required=True,
closest_hide_selector='.row' if not attendee.gets_staff_shirt or c.SHIRT_OPTS == c.STAFF_SHIRT_OPTS else '.form-floating',
source_field_id=id_upgrade_prepend ~ "amount_extra") }}
{% if not attendee.gets_staff_shirt or c.SHIRT_OPTS != c.STAFF_SHIRT_OPTS %}
{{ form_macros.toggle_fields_js(badge_extras.amount_extra, [badge_extras.shirt], off_values=["0"], toggle_required=True,
closest_hide_selector='.row' if not attendee.gets_staff_shirt else '.form-floating',
source_field_id=id_upgrade_prepend ~ "amount_extra") }}
{% endif %}
{% else %}
<div class="row g-sm-3">
<div class="col-12 col-sm-6">
Expand Down

0 comments on commit 27ec000

Please sign in to comment.