Skip to content

Commit

Permalink
feat: Close event register in 1 hour before start (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
azare242 authored Dec 5, 2023
1 parent 331d7d3 commit cd51248
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions backend/backend_api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,10 @@ def create_payment_for_user(user: User, discount: Discount):
raise ValidationError(
new_detailed_response(status.HTTP_400_BAD_REQUEST,
f"Workshop {workshop.id} is full"))
if workshop.start_date - timezone.now() <= timezone.timedelta(hours=1):
raise ValidationError(new_detailed_response(
status.HTTP_400_BAD_REQUEST, f"Workshop {workshop.id} Registraition closed"
))
total_cost += workshop.cost
workshops.append(workshop)
except ObjectDoesNotExist:
Expand All @@ -465,6 +469,11 @@ def create_payment_for_user(user: User, discount: Discount):
raise ValidationError(
new_detailed_response(status.HTTP_400_BAD_REQUEST,
f"Presentation {presentation.id} is full"))

if presentation.start_date - timezone.now() <= timezone.timedelta(hours=1):
raise ValidationError(new_detailed_response(
status.HTTP_400_BAD_REQUEST, f"Workshop {presentation.id} Participation closed"
))
total_cost += presentation.cost
presentations.append(presentation)
except ObjectDoesNotExist:
Expand Down

0 comments on commit cd51248

Please sign in to comment.