diff options
author | Stan Hu <stanhu@gmail.com> | 2017-05-11 12:40:44 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-05-11 12:40:44 -0700 |
commit | e3bac7dffe87a6e5adb1b51700acedba09420515 (patch) | |
tree | 3cad0696bdfeb79609c0442f79708fbbed2d93f1 /app/models/commit_status.rb | |
parent | f4b6bc06da18bce9553032463ca2012d7cad7268 (diff) | |
parent | e7e132529bff3af38175076b84c818b6dea4b05f (diff) | |
download | gitlab-ce-sh-ajax-tests.tar.gz |
Merge branch 'master' into sh-ajax-testssh-ajax-tests
Diffstat (limited to 'app/models/commit_status.rb')
-rw-r--r-- | app/models/commit_status.rb | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 75d04fd2b08..ffafc678968 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -18,13 +18,7 @@ class CommitStatus < ActiveRecord::Base validates :name, presence: true alias_attribute :author, :user - - scope :latest, -> do - max_id = unscope(:select).select("max(#{quoted_table_name}.id)") - - where(id: max_id.group(:name, :commit_id)) - end - + scope :failed_but_allowed, -> do where(allow_failure: true, status: [:failed, :canceled]) end @@ -37,7 +31,8 @@ class CommitStatus < ActiveRecord::Base false, all_state_names - [:failed, :canceled, :manual]) end - scope :retried, -> { where.not(id: latest) } + scope :latest, -> { where(retried: [false, nil]) } + scope :retried, -> { where(retried: true) } scope :ordered, -> { order(:name) } scope :latest_ordered, -> { latest.ordered.includes(project: :namespace) } scope :retried_ordered, -> { retried.ordered.includes(project: :namespace) } |