summaryrefslogtreecommitdiff
path: root/app/models/ci
diff options
context:
space:
mode:
authorPaco Guzman <pacoguzmanp@gmail.com>2016-08-23 11:27:22 +0200
committerPaco Guzman <pacoguzmanp@gmail.com>2016-08-25 14:42:18 +0200
commit6280fd3777920670ee42111fddf29576cbf85988 (patch)
treedcb44ce2f9fc19fca073d4818d292996749f2461 /app/models/ci
parent7bbb523b23638c52b3c0ba43d8f3dbef8840aad6 (diff)
downloadgitlab-ce-6280fd3777920670ee42111fddf29576cbf85988.tar.gz
Reduce number of database queries on builds tab13912-reduce-pipeline-db-queries
Diffstat (limited to 'app/models/ci')
-rw-r--r--app/models/ci/build.rb2
-rw-r--r--app/models/ci/pipeline.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 096b3b801af..23c8de6f650 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -352,7 +352,7 @@ module Ci
end
def artifacts?
- !artifacts_expired? && artifacts_file.exists?
+ !artifacts_expired? && self[:artifacts_file].present?
end
def artifacts_metadata?
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index 087abe4cbb1..aff908ea16c 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -83,7 +83,7 @@ module Ci
end
def stages_with_latest_statuses
- statuses.latest.order(:stage_idx).group_by(&:stage)
+ statuses.latest.includes(project: :namespace).order(:stage_idx).group_by(&:stage)
end
def project_id