summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2018-10-22 08:59:16 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2018-10-22 08:59:16 +0000
commitfdcdc36eecdbe904cf80fa130aebf4edd34c3f12 (patch)
tree3f1e1e8ca07448d4e5ac22b53e359be4a907bea4 /app
parentb5dfa745800a38cc17cadc0aa49a933713bdc1a5 (diff)
parentfb685031d8c60ca1d8f607c569cd519875e873c9 (diff)
downloadgitlab-ce-fdcdc36eecdbe904cf80fa130aebf4edd34c3f12.tar.gz
Merge branch 'drop-allow_overflow-option-duration_in_numbers' into 'master'
Drop allow overflow option duration in numbers Closes #52284 See merge request gitlab-org/gitlab-ce!22246
Diffstat (limited to 'app')
-rw-r--r--app/helpers/time_helper.rb16
-rw-r--r--app/views/projects/ci/builds/_build.html.haml2
2 files changed, 8 insertions, 10 deletions
diff --git a/app/helpers/time_helper.rb b/app/helpers/time_helper.rb
index 3e6a301b77d..719c351242c 100644
--- a/app/helpers/time_helper.rb
+++ b/app/helpers/time_helper.rb
@@ -21,17 +21,15 @@ module TimeHelper
"#{from.to_s(:short)} - #{to.to_s(:short)}"
end
- def duration_in_numbers(duration_in_seconds, allow_overflow = false)
- if allow_overflow
- seconds = duration_in_seconds % 1.minute
- minutes = (duration_in_seconds / 1.minute) % (1.hour / 1.minute)
- hours = duration_in_seconds / 1.hour
+ def duration_in_numbers(duration_in_seconds)
+ seconds = duration_in_seconds % 1.minute
+ minutes = (duration_in_seconds / 1.minute) % (1.hour / 1.minute)
+ hours = duration_in_seconds / 1.hour
- "%02d:%02d:%02d" % [hours, minutes, seconds]
+ if hours == 0
+ "%02d:%02d" % [minutes, seconds]
else
- time_format = duration_in_seconds < 1.hour ? "%M:%S" : "%H:%M:%S"
-
- Time.at(duration_in_seconds).utc.strftime(time_format)
+ "%02d:%02d:%02d" % [hours, minutes, seconds]
end
end
end
diff --git a/app/views/projects/ci/builds/_build.html.haml b/app/views/projects/ci/builds/_build.html.haml
index f975e37ee72..f5685d3b50d 100644
--- a/app/views/projects/ci/builds/_build.html.haml
+++ b/app/views/projects/ci/builds/_build.html.haml
@@ -108,7 +108,7 @@
.btn.btn-default.has-tooltip{ disabled: true,
title: job.scheduled_at }
= sprite_icon('planning')
- = duration_in_numbers(job.execute_in, true)
+ = duration_in_numbers(job.execute_in)
- confirmation_message = s_("DelayedJobs|Are you sure you want to run %{job_name} immediately? This job will run automatically after it's timer finishes.") % { job_name: job.name }
= link_to play_project_job_path(job.project, job, return_to: request.original_url),
method: :post,