|
|
|
@ -105,7 +105,6 @@ class Match(models.Model): |
|
|
|
def magic_duration(self): |
|
|
|
def magic_duration(self): |
|
|
|
seconds = (self.end_date - self.start_date).total_seconds() |
|
|
|
seconds = (self.end_date - self.start_date).total_seconds() |
|
|
|
average_duration = self.average_seconds_duration() |
|
|
|
average_duration = self.average_seconds_duration() |
|
|
|
# print(f"{average_duration} / {seconds}") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (average_duration / 2) > seconds or seconds > (average_duration * 2): |
|
|
|
if (average_duration / 2) > seconds or seconds > (average_duration * 2): |
|
|
|
seconds = average_duration |
|
|
|
seconds = average_duration |
|
|
|
@ -126,12 +125,7 @@ class Match(models.Model): |
|
|
|
if self.end_date: |
|
|
|
if self.end_date: |
|
|
|
return (self.end_date - self.start_date).total_seconds() |
|
|
|
return (self.end_date - self.start_date).total_seconds() |
|
|
|
else: |
|
|
|
else: |
|
|
|
current = (timezone.now() - self.start_date).total_seconds() |
|
|
|
return (timezone.now() - self.start_date).total_seconds() |
|
|
|
if current < self.average_seconds_duration() * 2: |
|
|
|
|
|
|
|
return current |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
return None |
|
|
|
|
|
|
|
# return (timezone.now() - self.start_date).total_seconds() |
|
|
|
|
|
|
|
else: |
|
|
|
else: |
|
|
|
return 0 |
|
|
|
return 0 |
|
|
|
|
|
|
|
|
|
|
|
|