X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/4eaf39dbe947beaaa87e656b470d7f21880ba607..aecc7109edd37aee2388c06a36d5c8ba853b3267:/apps/workbench/app/helpers/pipeline_instances_helper.rb?ds=sidebyside diff --git a/apps/workbench/app/helpers/pipeline_instances_helper.rb b/apps/workbench/app/helpers/pipeline_instances_helper.rb index 9d1a0c3e6c..f0c4eb7288 100644 --- a/apps/workbench/app/helpers/pipeline_instances_helper.rb +++ b/apps/workbench/app/helpers/pipeline_instances_helper.rb @@ -218,7 +218,6 @@ module PipelineInstancesHelper HOUR = 60 * MINUTE DAY = 24 * HOUR - def render_runtime duration, use_words, round_to_min=true days = 0 hours = 0 @@ -244,12 +243,12 @@ module PipelineInstancesHelper if round_to_min and seconds >= 30 minutes += 1 - end + end if use_words s = "" if days > 0 then - s += "#{day} day#{'s' if days != 1}" + s += "#{days} day#{'s' if days != 1}" end if hours > 0 then s += " #{hours} hour#{'s' if hours != 1}" @@ -263,22 +262,21 @@ module PipelineInstancesHelper else s = "" if days > 0 - s += "#{days}d#{hours.to_s.rjust(2, '0')}h" - elsif (hours > 0) - s += "#{hours}h" + s += "#{days}d " end if (hours > 0) - s += "#{minutes.to_s.rjust(2, '0')}m" - else - s += "#{minutes}m" + s += "#{hours}h" end + + s += "#{minutes}m" + if not round_to_min - s += "#{seconds.to_s.rjust(2, '0')}s" + s += "#{seconds}s" end end - s + raw(s) end end