Skip to content

Commit

Permalink
Fix ValueError and more renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
itsisak committed Oct 9, 2024
1 parent 030a46f commit 11f50ab
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
11 changes: 3 additions & 8 deletions lego/apps/events/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,15 +577,10 @@ def notify_event_creator_when_payment_overdue(self, logger_context=None):


@celery_app.task(serializer="json", bind=True, base=AbakusTask)
def assign_penalties_and_unregister_when_payment_overdue(self, logger_context=None):
def handle_overdue_payment(self, logger_context=None):
"""
Task that automatically assigns prikk.
Gives penalty
Unregisters
Sends email
TODO:
Do not check now but payment deadline instead
Do not unregister if they have paid, even after deadline?
Task that automatically assigns penalty, unregisters user from event
and notifies them when payment is overdue.
"""

self.setup_logger(logger_context)
Expand Down
6 changes: 3 additions & 3 deletions lego/apps/events/tests/test_async_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from lego.apps.events.models import Event, Registration
from lego.apps.events.tasks import (
AsyncRegister,
assign_penalties_and_unregister_when_payment_overdue,
handle_overdue_payment,
async_register,
async_retrieve_payment,
bump_waiting_users_to_new_pool,
Expand Down Expand Up @@ -805,7 +805,7 @@ def test_user_is_given_penalty_is_unregistered_and_notified(
number_of_registrations_before = self.event.number_of_registrations
number_of_penalties_before = registration_two.user.number_of_penalties()

assign_penalties_and_unregister_when_payment_overdue.delay()
handle_overdue_payment.delay()
registration_two.refresh_from_db()

self.assertLess(
Expand Down Expand Up @@ -841,7 +841,7 @@ def test_user_is_not_given_penalty_is_not_unregistered_and_not_notified(
number_of_registrations_before = self.event.number_of_registrations
number_of_penalties_before = registration_two.user.number_of_penalties()

assign_penalties_and_unregister_when_payment_overdue.delay()
handle_overdue_payment.delay()
registration_two.refresh_from_db()

self.assertEqual(
Expand Down
1 change: 1 addition & 0 deletions lego/apps/notifications/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
EVENT_ADMIN_REGISTRATION,
EVENT_ADMIN_UNREGISTRATION,
EVENT_PAYMENT_OVERDUE,
EVENT_PAYMENT_OVERDUE_PENALTY,
MEETING_INVITE,
MEETING_INVITATION_REMINDER,
PENALTY_CREATION,
Expand Down
4 changes: 2 additions & 2 deletions lego/settings/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def on_setup_logging(**kwargs):
"task": "lego.apps.events.tasks.notify_event_creator_when_payment_overdue",
"schedule": crontab(hour=21, minute=0),
},
"assign_penalties_and_unregister_when_payment_overdue": {
"task": "lego.apps.events.tasks.assign_penalties_and_unregister_when_payment_overdue",
"handle_overdue_payment": {
"task": "lego.apps.events.tasks.handle_overdue_payment",
"schedule": crontab(hour=9, minute=0),
},
"sync-external-systems": {
Expand Down

0 comments on commit 11f50ab

Please sign in to comment.