Skip to content

Commit

Permalink
slightly changed holding updates, added update to holding status when…
Browse files Browse the repository at this point in the history
… adding to cart
  • Loading branch information
Dfeng6789 authored and rohangpta committed Oct 2, 2022
1 parent 4bf90cc commit 74183d4
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions backend/clubs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2241,6 +2241,12 @@ def cart(self, request, *args, **kwargs):
- $ref: "#/components/schemas/Ticket"
---
"""
# Update holding status for all held tickets
held_tickets = Ticket.objects.filter(held=True).all()
for ticket in held_tickets:
if ticket.holding_expiration <= timezone.now():
ticket.held = False
ticket.save()
type = request.data.get("type")
count = request.data.get("count")
event = Event.objects.get(id=self.get_object().id)
Expand Down Expand Up @@ -2282,12 +2288,12 @@ def validate_cart(self, request, *args, **kwargs):
- $ref: "#/components/schemas/Ticket"
---
"""
# Update holding expirations for all tickets
for ticket in Ticket.objects.all():
if ticket.holding_expiration:
if ticket.holding_expiration <= timezone.now():
ticket.held = False
ticket.save()
# Update holding status for all held tickets
held_tickets = Ticket.objects.filter(held=True).all()
for ticket in held_tickets:
if ticket.holding_expiration <= timezone.now():
ticket.held = False
ticket.save()

cart = Cart.objects.filter(owner=self.request.user).first()

Expand Down

0 comments on commit 74183d4

Please sign in to comment.