From 8e84acbf2e7e306ba937aaae87cfed35d2632e10 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Tue, 12 Apr 2016 19:57:54 +0200 Subject: Optimise CI status accessor --- app/models/ci/commit.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app/models/ci/commit.rb') diff --git a/app/models/ci/commit.rb b/app/models/ci/commit.rb index 94951ced1fd..8865bd76bd2 100644 --- a/app/models/ci/commit.rb +++ b/app/models/ci/commit.rb @@ -44,8 +44,12 @@ module Ci sha[0...8] end + def self.stages + CommitStatus.where(commit: all).stages + end + def stages - statuses.group(:stage).order(:stage_idx).pluck(:stage) + statuses.stages end def project_id -- cgit v1.2.1