diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-08-02 19:56:00 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-08-02 19:56:00 +0900 |
commit | d867081df185b873667d9eec1184ac92efc8973e (patch) | |
tree | d8bb7a2ff057c9727ebc2bd9ec303c661fcf0043 | |
parent | 394ea2f9ca4cb11ca942249792535c3bb689fa37 (diff) | |
download | gitlab-ce-d867081df185b873667d9eec1184ac92efc8973e.tar.gz |
Simplify the query to fetch base and head pipelines
-rw-r--r-- | app/models/merge_request.rb | 7 |
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) |