diff options
Diffstat (limited to 'app/models/commit_status.rb')
-rw-r--r-- | app/models/commit_status.rb | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 06d296eef08..24a26b4be8c 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -93,7 +93,10 @@ class CommitStatus < ActiveRecord::Base end def self.stages_status - Hash[group(:stage).pluck(:stage, self.status_sql)] + all.stages.inject({}) do |h, stage| + h[stage] = all.where(stage: stage).status + h + end end def ignored? @@ -101,11 +104,13 @@ class CommitStatus < ActiveRecord::Base end def duration - if started_at && finished_at - finished_at - started_at - elsif started_at - Time.now - started_at - end + duration = + if started_at && finished_at + finished_at - started_at + elsif started_at + Time.now - started_at + end + duration.to_i end def stuck? |