Commit e9bd8b61 authored by Annabel Dunstone's avatar Annabel Dunstone

Update time format of duration

parent 96684317
...@@ -23,4 +23,11 @@ module TimeHelper ...@@ -23,4 +23,11 @@ module TimeHelper
def date_from_to(from, to) def date_from_to(from, to)
"#{from.to_s(:short)} - #{to.to_s(:short)}" "#{from.to_s(:short)} - #{to.to_s(:short)}"
end end
def duration_in_numbers(finished_at, started_at)
diff_in_seconds = finished_at.to_i - started_at.to_i
time_format = diff_in_seconds < 3600 ? "%M:%S" : "%H:%M:%S"
Time.at(diff_in_seconds).utc.strftime(time_format)
end
end end
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
%td %td
- if pipeline.started_at && pipeline.finished_at - if pipeline.started_at && pipeline.finished_at
%p.duration %p.duration
#{duration_in_words(pipeline.finished_at, pipeline.started_at)} = duration_in_numbers(pipeline.finished_at, pipeline.started_at)
%td %td
.controls.hidden-xs.pull-right .controls.hidden-xs.pull-right
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment