Merge branch '18181-pipeline-duration' into 'master'
Update time format of pipeline duration Closes #18181 Part of #18920 See merge request !5121
This commit is contained in:
commit
39fbec9419
2 changed files with 8 additions and 1 deletions
|
@ -23,4 +23,11 @@ module TimeHelper
|
|||
def date_from_to(from, to)
|
||||
"#{from.to_s(:short)} - #{to.to_s(:short)}"
|
||||
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 < 1.hour ? "%M:%S" : "%H:%M:%S"
|
||||
|
||||
Time.at(diff_in_seconds).utc.strftime(time_format)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
%td
|
||||
- if pipeline.started_at && pipeline.finished_at
|
||||
%p.duration
|
||||
#{duration_in_words(pipeline.finished_at, pipeline.started_at)}
|
||||
= duration_in_numbers(pipeline.finished_at, pipeline.started_at)
|
||||
|
||||
%td
|
||||
.controls.hidden-xs.pull-right
|
||||
|
|
Loading…
Reference in a new issue