From 3953e5fcd7060e77405327e670f92ebd7d0ee5a0 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Tue, 10 May 2016 02:38:25 +0300 Subject: Update generic commit status to make it look like a build --- app/models/commit_status.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/models') diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 0c0c3d38f94..2d09edf3ca1 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -91,12 +91,12 @@ class CommitStatus < ActiveRecord::Base end def self.stages - # We group by stage name, but order stages by their's index + # We group by stage name, but order stages by theirs' index unscoped.from(all, :sg).group('stage').order('max(stage_idx)', 'stage').pluck('sg.stage') end def self.stages_status - # We execute subquery for each of the stages which calculates an Stage Status + # We execute subquery for each stage to calculate a stage status statuses = unscoped.from(all, :sg).group('stage').pluck('sg.stage', all.where('stage=sg.stage').status_sql) statuses.inject({}) do |h, k| h[k.first] = k.last -- cgit v1.2.1