diff options
-rw-r--r-- | app/models/commit_status.rb | 4 | ||||
-rw-r--r-- | app/models/concerns/has_status.rb | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 99622014662..ee3396abe04 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -32,8 +32,8 @@ class CommitStatus < ActiveRecord::Base scope :exclude_ignored, -> do quoted_when = connection.quote_column_name('when') # We want to ignore failed_but_allowed jobs - where("allow_failure = ? OR status NOT IN (?)", - false, [:failed, :canceled]). + where("allow_failure = ? OR status IN (?)", + false, all_state_names - [:failed, :canceled]). # We want to ignore skipped manual jobs where("#{quoted_when} <> ? OR status <> ?", 'manual', 'skipped'). # We want to ignore skipped on_failure diff --git a/app/models/concerns/has_status.rb b/app/models/concerns/has_status.rb index 2dd2c5f2c0f..9f64f76721d 100644 --- a/app/models/concerns/has_status.rb +++ b/app/models/concerns/has_status.rb @@ -43,6 +43,10 @@ module HasStatus def finished_at all.maximum(:finished_at) end + + def all_state_names + state_machines.values.flat_map(&:states).flat_map { |s| s.map(&:name) } + end end included do |