Skip to content

Commit

Permalink
Fix group discount not being applied in some cases
Browse files Browse the repository at this point in the history
If a group was free due to not having any 'paid by group' badges in it, the first badge added would not have a group discount applied to it. Also fixes an issue where the group's cost would not be updated when an admin added badges to the group.
  • Loading branch information
kitsuta committed Jan 5, 2025
1 parent 5038255 commit 7e30727
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion uber/models/attendee.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ def calculate_badge_cost(self, use_promo_code=False, include_price_override=True
return self.overridden_price
elif self.is_dealer:
return c.DEALER_BADGE_PRICE
elif self.promo_code_groups or (self.group and self.group.cost and self.paid == c.PAID_BY_GROUP):
elif self.promo_code_groups or (self.group and self.group.auto_recalc and self.paid == c.PAID_BY_GROUP):
return c.get_group_price()
else:
cost = self.new_badge_cost
Expand Down
2 changes: 2 additions & 0 deletions uber/site_sections/group_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ def form(self, session, new_dealer='', message='', **params):
new_ribbon_type=group.new_ribbons,
badge_status=new_badge_status,
)
session.commit()
session.refresh(group)

if group.is_dealer and group.status == c.SHARED:
if group.table_shares:
Expand Down

0 comments on commit 7e30727

Please sign in to comment.