summaryrefslogtreecommitdiff
path: root/app/models/commit_status.rb
diff options
context:
space:
mode:
authorRegis Boudinot <boudinot.regis@yahoo.com>2017-05-10 22:07:05 +0000
committerRegis Boudinot <boudinot.regis@yahoo.com>2017-05-10 22:07:05 +0000
commit81df0034f4b66f2627ecd92f0ca44b7a3a634719 (patch)
tree1fc94d4e272b314dbe8b484e5c7d4cbf9faffb6c /app/models/commit_status.rb
parent4086fca0f4dba977874c4b79b46578d6d603bfc5 (diff)
parent7eaab72b983a89040a01b9f32184fef258fb29f2 (diff)
downloadgitlab-ce-81df0034f4b66f2627ecd92f0ca44b7a3a634719.tar.gz
Merge branch 'retried-in-database-mysql' into 'master'
Retried in database Closes #25737 See merge request !11115
Diffstat (limited to 'app/models/commit_status.rb')
-rw-r--r--app/models/commit_status.rb11
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) }