Fix bug in assignment: date has no date
This made the assignment task crash.
This commit is contained in:
parent
e2a82dcf74
commit
4cf6498360
1 changed files with 2 additions and 2 deletions
|
@ -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(
|
||||||
|
|
Loading…
Reference in a new issue