mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-02 16:08:13 +08:00
Refactoring to make testing more stable
This commit is contained in:
+3
-1
@@ -20,7 +20,9 @@ class Task(models.Model):
|
||||
|
||||
@staticmethod
|
||||
def get_result(name):
|
||||
return Task.objects.get(name=name).result
|
||||
if Task.objects.filter(name=name).exists():
|
||||
return Task.objects.get(name=name).result
|
||||
return None
|
||||
|
||||
def time_taken(self):
|
||||
return (self.stopped - self.started).total_seconds()
|
||||
|
||||
Reference in New Issue
Block a user