Skip to content

Commit

Permalink
Merge pull request #4363 from magfest/fix-double-code-claim
Browse files Browse the repository at this point in the history
Fix promo group code counting
  • Loading branch information
kitsuta authored May 14, 2024
2 parents cbed8dc + 1e09637 commit ac90373
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions uber/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def get_badge_count_by_type(self, badge_type):
count = session.query(Attendee).filter(
Attendee.paid != c.NOT_PAID,
Attendee.badge_type == badge_type,
Attendee.has_or_will_have_badge == True).count() # noqa: E712
Attendee.has_badge == True).count() # noqa: E712
return count

def has_section_or_page_access(self, include_read_only=False, page_path=''):
Expand Down Expand Up @@ -406,7 +406,8 @@ def ATTENDEE_BADGE_COUNT(self):
from uber.models import Session, PromoCode, PromoCodeGroup
base_count = self.get_badge_count_by_type(c.ATTENDEE_BADGE)
with Session() as session:
pc_code_count = session.query(PromoCode).join(PromoCodeGroup).filter(PromoCode.cost > 0).count()
pc_code_count = session.query(PromoCode).join(PromoCodeGroup).filter(PromoCode.cost > 0,
PromoCode.uses_remaining > 0).count()
return base_count + pc_code_count

@request_cached_property
Expand Down Expand Up @@ -787,7 +788,7 @@ def AT_THE_DOOR_BADGE_OPTS(self):
opts.append((badge, day_name + ' Badge (${})'.format(price)))
day += timedelta(days=1)
elif self.ONE_DAY_BADGE_AVAILABLE:
opts.append((self.ONE_DAY_BADGE, 'Single Day Badge (${})'.format(self.ONEDAY_BADGE_PRICE)))
opts.append((self.ONE_DAY_BADGE, 'Single Day Badge (${})'.format(self.ONEDAY_BADGE_PRICE)))
return opts

@property
Expand Down Expand Up @@ -1512,8 +1513,8 @@ def _unrepr(d):
c.MAX_BADGE = max(xs[1] for xs in c.BADGE_RANGES.values())

c.JOB_PAGE_OPTS = (
('index', 'Calendar View'),
('signups', 'Signups View'),
('index', 'Calendar View'),
('signups', 'Signups View'),
('staffers', 'Staffer Summary'),
)
c.WEIGHT_OPTS = (
Expand Down

0 comments on commit ac90373

Please sign in to comment.