Prevent error from empty timestamps
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
126e758172
commit
c6bb60bbbb
|
@ -41,6 +41,9 @@ class Session(models.Model):
|
|||
return f"{str(self.purchase)} {str(self.timestamp_start.date())} ({self.total_duration()}{mark})"
|
||||
|
||||
def calculated_duration(self):
|
||||
if self.timestamp_end == None or self.timestamp_start == None:
|
||||
return 0
|
||||
else:
|
||||
return self.timestamp_end - self.timestamp_start
|
||||
|
||||
def total_duration(self):
|
||||
|
|
Loading…
Reference in New Issue