Commit 61bc90af authored by Lin Jen-Shin's avatar Lin Jen-Shin

Be more specific since it's not needed to be generic now,

feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6084#note_14995016
parent 7351c269
...@@ -91,12 +91,14 @@ module Gitlab ...@@ -91,12 +91,14 @@ module Gitlab
builds = pipeline.builds.latest. builds = pipeline.builds.latest.
where(status: status).where.not(started_at: nil).order(:started_at) where(status: status).where.not(started_at: nil).order(:started_at)
from_builds(builds, :started_at, :finished_at) from_builds(builds)
end end
def from_builds(builds, from, to, now = Time.now) def from_builds(builds)
now = Time.now
periods = builds.map do |b| periods = builds.map do |b|
Period.new(b.public_send(from) || now, b.public_send(to) || now) Period.new(b.started_at, b.finished_at || now)
end end
from_periods(periods) from_periods(periods)
......
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