Fixes displayed duration

clubs
Laurent 1 year ago
parent 14a2951fb9
commit bfcf3500ad
  1. 16
      tournaments/models/match.py

@ -125,7 +125,21 @@ class Match(models.Model):
if self.end_date:
return (self.end_date - self.start_date).total_seconds()
else:
return (timezone.now() - self.start_date).total_seconds()
current = (timezone.now() - self.start_date).total_seconds()
if self.total_number_of_games() > 0 and current < self.average_seconds_duration() * 4:
return current
elif self.total_number_of_games() == 0 and current < 4 * 60 * 60:
return current
else:
return None
# print(current)
# print(self.average_seconds_duration())
# print('*******')
# if current < self.average_seconds_duration() * 4:
# return current
# else:
# return None
# return (timezone.now() - self.start_date).total_seconds()
else:
return 0

Loading…
Cancel
Save