diff --git a/tournaments/models/match.py b/tournaments/models/match.py index 814b3cf..f3c0274 100644 --- a/tournaments/models/match.py +++ b/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