Skip to content

Commit b35b33e

Browse files
kkthxbye-codejeremystretch
authored andcommitted
Use the start time to calculate duration of jobs instead of created time
1 parent db5c2a3 commit b35b33e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

netbox/extras/models/models.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,12 @@ def duration(self):
651651
if not self.completed:
652652
return None
653653

654-
duration = self.completed - self.created
654+
start_time = self.started or self.created
655+
656+
if not start_time:
657+
return None
658+
659+
duration = self.completed - start_time
655660
minutes, seconds = divmod(duration.total_seconds(), 60)
656661

657662
return f"{int(minutes)} minutes, {seconds:.2f} seconds"

0 commit comments

Comments
 (0)