Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-10-04 19:10:23 +0300
committerLin Jen-Shin <godfat@godfat.org>2016-10-04 19:10:23 +0300
commit5c9ac560e7e916c8a082c99309fbd4031b1a6803 (patch)
tree55e766ff1bbffd0be537f558d3c71b1a38b307d1 /app/models/concerns
parentaafb0171e6fb17789754ee71bc5c3c6bca94bf7b (diff)
Introduce all_state_names so that we could avoid NOT IN
Diffstat (limited to 'app/models/concerns')
-rw-r--r--app/models/concerns/has_status.rb4
1 files changed, 4 insertions, 0 deletions
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