Compare commits
3 commits
c9fbd8335c
...
f019011223
| Author | SHA1 | Date | |
|---|---|---|---|
| f019011223 | |||
| 46b58b95e5 | |||
| a685393298 |
1 changed files with 4 additions and 4 deletions
|
|
@ -721,14 +721,14 @@ async def api_ticket_create(
|
||||||
detail="Promo code is not active.",
|
detail="Promo code is not active.",
|
||||||
)
|
)
|
||||||
usage = await event_promo_usage(event.id)
|
usage = await event_promo_usage(event.id)
|
||||||
uses_left = remaining_uses(promo, usage.get(promo.code, 0))
|
remaining = remaining_uses(promo, usage.get(promo.code, 0))
|
||||||
if uses_left is not None and uses_left < quantity:
|
if remaining is not None and remaining < quantity:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=HTTPStatus.BAD_REQUEST,
|
status_code=HTTPStatus.BAD_REQUEST,
|
||||||
detail=(
|
detail=(
|
||||||
"Promo code has been fully redeemed."
|
"Promo code has been fully redeemed."
|
||||||
if uses_left == 0
|
if remaining == 0
|
||||||
else f"Only {uses_left} use(s) left on this promo code."
|
else f"Only {remaining} use(s) left on this promo code."
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
extra["promo_code"] = promo.code
|
extra["promo_code"] = promo.code
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue