Explicitly set Timer.duration to None on instance save when the instance is still running.

This has to be done because the Timer.from_db() method fills in duration against the current time when the instance is still active. This issue was introduced in fd960cd.
This commit is contained in:
Christopher Charbonneau Wells 2017-10-28 12:43:43 -04:00
parent f02f28b7f9
commit 03dc139b0e
1 changed files with 2 additions and 0 deletions

View File

@ -183,6 +183,8 @@ class Timer(models.Model):
self.name = self.name or None
if self.start and self.end:
self.duration = self.end - self.start
else:
self.duration = None
super(Timer, self).save(*args, **kwargs)