From 3e88f1d207f2948985388ba6f0249ea877d2519c Mon Sep 17 00:00:00 2001 From: Midgard Date: Sat, 25 Jul 2020 18:28:04 +0200 Subject: [PATCH] Remove magic constants "A" and "I" These stand for "admitted" and "interested", but we have constants for that. --- events/tasks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/events/tasks.py b/events/tasks.py index 6f24540..c8ab70f 100644 --- a/events/tasks.py +++ b/events/tasks.py @@ -10,7 +10,7 @@ def calc_score(user: CustomUser): registrations_last_month = EventRegistration.objects.all().filter(user_id=user.id, event__date__gt=date.today() - timedelta(days=30), event__date__lte=date.today(), - state__exact='A') + state=EventRegistration.ADMITTED) score = 0 for r in registrations_last_month: days_ago = (date.today() - r.event.date.date()).days @@ -35,7 +35,7 @@ def assign_reservations(self): # Reservations registrations: List[EventRegistration] = EventRegistration.objects.all().filter( event_id__in=map(lambda event: event.id, events), - state__exact='I') + state=EventRegistration.INTERESTED) if len(registrations) == 0: print("NO REGISTRATIONS?")