mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Use the start time to calculate duration of jobs instead of created time
This commit is contained in:
committed by
Jeremy Stretch
parent
db5c2a379e
commit
b35b33e798
@ -651,7 +651,12 @@ class JobResult(models.Model):
|
|||||||
if not self.completed:
|
if not self.completed:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
duration = self.completed - self.created
|
start_time = self.started or self.created
|
||||||
|
|
||||||
|
if not start_time:
|
||||||
|
return None
|
||||||
|
|
||||||
|
duration = self.completed - start_time
|
||||||
minutes, seconds = divmod(duration.total_seconds(), 60)
|
minutes, seconds = divmod(duration.total_seconds(), 60)
|
||||||
|
|
||||||
return f"{int(minutes)} minutes, {seconds:.2f} seconds"
|
return f"{int(minutes)} minutes, {seconds:.2f} seconds"
|
||||||
|
Reference in New Issue
Block a user