summaryrefslogtreecommitdiff
path: root/app/models/concerns/ci/has_status.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/concerns/ci/has_status.rb')
-rw-r--r--app/models/concerns/ci/has_status.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/app/models/concerns/ci/has_status.rb b/app/models/concerns/ci/has_status.rb
index c990da5873a..f3c254053b5 100644
--- a/app/models/concerns/ci/has_status.rb
+++ b/app/models/concerns/ci/has_status.rb
@@ -122,12 +122,10 @@ module Ci
private
- def calculate_duration
- if started_at && finished_at
- finished_at - started_at
- elsif started_at
- Time.current - started_at
- end
+ def calculate_duration(start_time, end_time)
+ return unless start_time
+
+ (end_time || Time.current) - start_time
end
end
end