diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2016-09-14 19:40:31 +0530 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2016-09-14 19:40:31 +0530 |
commit | 74626106bb688b0b76b30fc00a71627d94806b3a (patch) | |
tree | 6f9699f335f2a900ee7ac7d21df0339e1569b79c /app/models/cycle_analytics | |
parent | 2110989fe360c2c3a31adc7272524ab83f37de83 (diff) | |
download | gitlab-ce-74626106bb688b0b76b30fc00a71627d94806b3a.tar.gz |
wip: perf
Diffstat (limited to 'app/models/cycle_analytics')
-rw-r--r-- | app/models/cycle_analytics/queries.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/cycle_analytics/queries.rb b/app/models/cycle_analytics/queries.rb index 32c49ec52ba..861460f1de4 100644 --- a/app/models/cycle_analytics/queries.rb +++ b/app/models/cycle_analytics/queries.rb @@ -2,7 +2,7 @@ class CycleAnalytics module Queries class << self def issues(project, created_after:) - project.issues.where("created_at >= ?", created_after).map { |issue| { issue: issue } } + project.issues.where("created_at >= ?", created_after).preload(:metrics, :system_notes).map { |issue| { issue: issue } } end def merge_requests_closing_issues(project, options = {}) @@ -29,7 +29,7 @@ class CycleAnalytics def issue_first_mentioned_in_commit_at lambda do |data_point| issue = data_point[:issue] - commits_mentioning_issue = issue.notes.system.map { |note| note.all_references.commits }.flatten + commits_mentioning_issue = issue.system_notes.map { |note| note.all_references.commits }.flatten commits_mentioning_issue.map(&:committed_date).min if commits_mentioning_issue.present? end end |