From 4cf6498360d89098e32b510f741912e4bdc9f927 Mon Sep 17 00:00:00 2001 From: Midgard Date: Sun, 26 Jul 2020 01:15:27 +0200 Subject: [PATCH] Fix bug in assignment: date has no date This made the assignment task crash. --- events/tasks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/events/tasks.py b/events/tasks.py index dd8ccf2..f323745 100644 --- a/events/tasks.py +++ b/events/tasks.py @@ -13,7 +13,7 @@ def calc_score(user: CustomUser): state=EventRegistration.ADMITTED) score = 0 for r in registrations_last_month: - days_ago = (date.today() - r.event.date.date()).days + days_ago = (date.today() - r.event.date).days score += 1 / (days_ago + 1) return score @@ -30,7 +30,7 @@ def assign_reservations(self): print("Assigning reservations") print("======================") # Get all events of tomorrow - events = Event.objects.filter(date__date=date.today() + timedelta(days=1)) + events = Event.objects.filter(date=date.today() + timedelta(days=1)) # Reservations registrations: List[EventRegistration] = EventRegistration.objects.filter(