summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-11-06 08:30:50 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2018-11-06 08:30:50 +0000
commit1109c227e57fac8c53b331b2cda21a87b61970aa (patch)
treef72cc4c5e1de1f6bd53a811b9b5fd2718f237ac8 /app
parent836ab5f7a189129d381ee55972415ce68023f1a1 (diff)
parenta89fb014a3f520d44351489bca73a42f3d4d42e8 (diff)
downloadgitlab-ce-1109c227e57fac8c53b331b2cda21a87b61970aa.tar.gz
Merge branch 'ce-fix_vuln_list_on_group_dashboard' into 'master'
Backport generic methods to CE See merge request gitlab-org/gitlab-ce!22826
Diffstat (limited to 'app')
-rw-r--r--app/models/ci/pipeline.rb4
-rw-r--r--app/models/namespace.rb6
2 files changed, 10 insertions, 0 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index aeee7f0a5d2..0daf2419b67 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -238,6 +238,10 @@ module Ci
end
end
+ def self.latest_successful_ids_per_project
+ success.group(:project_id).select('max(id) as id')
+ end
+
def self.truncate_sha(sha)
sha[0...8]
end
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index 74d48d0a9af..4a6627d3ca1 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -232,6 +232,12 @@ class Namespace < ActiveRecord::Base
Project.inside_path(full_path)
end
+ # Includes pipelines from this namespace and pipelines from all subgroups
+ # that belongs to this namespace
+ def all_pipelines
+ Ci::Pipeline.where(project: all_projects)
+ end
+
def has_parent?
parent.present?
end