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:
authorShinya Maeda <shinya@gitlab.com>2018-08-02 13:56:00 +0300
committerShinya Maeda <shinya@gitlab.com>2018-08-02 13:56:00 +0300
commitd867081df185b873667d9eec1184ac92efc8973e (patch)
treed8bb7a2ff057c9727ebc2bd9ec303c661fcf0043
parent394ea2f9ca4cb11ca942249792535c3bb689fa37 (diff)
Simplify the query to fetch base and head pipelines
-rw-r--r--app/models/merge_request.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index 731937b1bc5..a99b197af66 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -1029,11 +1029,8 @@ class MergeRequest < ActiveRecord::Base
def calculate_reactive_cache(base_pipeline_iid, head_pipeline_iid)
begin
- if base_pipeline_iid
- base_pipeline, head_pipeline = project.pipelines.where(iid: [base_pipeline_iid, head_pipeline_iid]).all
- else
- head_pipeline = project.pipelines.find(iid: head_pipeline_iid)
- end
+ base_pipeline = project.pipelines.find_by_iid(base_pipeline_iid)
+ head_pipeline = project.pipelines.find_by_iid(head_pipeline_iid)
comparer = Gitlab::Ci::Reports::TestReportsComparer
.new(base_pipeline&.test_reports, head_pipeline.test_reports)