Merge branch 'improve-assignment' into 'master'

Fix bug in assignment: date has no date

See merge request bestuur/kers!6
This commit is contained in:
j 2020-07-26 02:30:36 +02:00
commit 295de3f5d5

View file

@ -13,7 +13,7 @@ def calc_score(user: CustomUser):
state=EventRegistration.ADMITTED) state=EventRegistration.ADMITTED)
score = 0 score = 0
for r in registrations_last_month: 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) score += 1 / (days_ago + 1)
return score return score
@ -30,7 +30,7 @@ def assign_reservations(self):
print("Assigning reservations") print("Assigning reservations")
print("======================") print("======================")
# Get all events of tomorrow # 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 # Reservations
registrations: List[EventRegistration] = EventRegistration.objects.filter( registrations: List[EventRegistration] = EventRegistration.objects.filter(