diff --git a/app/content/models/registration.py b/app/content/models/registration.py index 795bdc9c..418cb145 100644 --- a/app/content/models/registration.py +++ b/app/content/models/registration.py @@ -135,7 +135,9 @@ def delete(self, *args, **kwargs): if moved_registration.event.is_paid_event: try: start_payment_countdown( - moved_registration.event, moved_registration + moved_registration.event, + moved_registration, + from_wait_list=True, ) except Exception as countdown_error: capture_exception(countdown_error) diff --git a/app/content/util/event_utils.py b/app/content/util/event_utils.py index 30852acd..d6343190 100644 --- a/app/content/util/event_utils.py +++ b/app/content/util/event_utils.py @@ -12,7 +12,7 @@ ) -def start_payment_countdown(event, registration): +def start_payment_countdown(event, registration, from_wait_list=False): """ Checks if event is a paid event and starts the countdown for payment for an user. @@ -24,13 +24,18 @@ def start_payment_countdown(event, registration): try: check_if_has_paid.apply_async( args=(event.id, registration.registration_id), - countdown=get_countdown_time(event), + countdown=get_countdown_time(event, from_wait_list), ) except Exception as payment_countdown_error: capture_exception(payment_countdown_error) -def get_countdown_time(event): +def get_countdown_time(event, from_wait_list=False): + if from_wait_list: + # 12 hours and 10 minutes as seconds + return (12 * 60 * 60) + (10 * 60) + + # paytime as seconds paytime = event.paid_information.paytime return (paytime.hour * 60 + paytime.minute + 10) * 60 + paytime.second