diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-05-13 17:11:57 -0500 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-05-13 17:11:57 -0500 |
commit | 6d19e13df62376916e024ff44939bf2a8f5b671b (patch) | |
tree | 4b5bae7c18ee25ebdc73be3730ed36efd270eef8 /app/models | |
parent | c1bc5c58a2861af25f4f03e0a757dceae4b67cda (diff) | |
download | gitlab-ce-6d19e13df62376916e024ff44939bf2a8f5b671b.tar.gz |
Fix specs
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/commit_status.rb | 11 | ||||
-rw-r--r-- | app/models/project.rb | 2 |
2 files changed, 4 insertions, 9 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 2d09edf3ca1..c7451ea0a86 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -92,16 +92,11 @@ class CommitStatus < ActiveRecord::Base def self.stages # 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') + unscoped.where(id: all).group('stage').order('max(stage_idx)', 'stage').pluck('stage') end - def self.stages_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 - h - end + def self.status_for_stage(stage) + where(stage: stage).status end def ignored? diff --git a/app/models/project.rb b/app/models/project.rb index 82489235a3f..dfd1e54ecf7 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -354,7 +354,7 @@ class Project < ActiveRecord::Base join_body = "INNER JOIN ( SELECT project_id, COUNT(*) AS amount FROM notes - WHERE created_at >= #{sanitize(since)}project.ci_commits + WHERE created_at >= #{sanitize(since)} GROUP BY project_id ) join_note_counts ON projects.id = join_note_counts.project_id" |