diff --git a/backend/backend_api/models.py b/backend/backend_api/models.py index d998ca4..a89178b 100644 --- a/backend/backend_api/models.py +++ b/backend/backend_api/models.py @@ -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: @@ -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: