diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-04-16 14:14:39 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-05-07 23:43:53 +0300 |
commit | f2a4420d66216e3a9172f4ab45c6b4fa96578117 (patch) | |
tree | 6b7c8845c085f804a02e2ead9109910fd30e667e /app/models/commit_status.rb | |
parent | 6ad3814e1b31bfacfae7a2aabb4e4607b12ca66f (diff) |
Store retried in database for CI builds
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 2c4033146bf..528bf4d87ac 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) } + 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) } |