Fix bug in assignment: date has no date

This made the assignment task crash.
This commit is contained in:
Midgard 2020-07-26 01:15:27 +02:00
parent e2a82dcf74
commit 4cf6498360
Signed by: midgard
GPG key ID: 511C112F1331BBB4

View file

@ -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(