diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2016-09-02 09:44:39 +0530 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2016-09-02 09:44:39 +0530 |
commit | 0910868d3cdd63d416f711df0f12ab67d4328130 (patch) | |
tree | 593bd78c086a5ccfd51c15ebec527042a5a3ba3a /app/models/cycle_analytics | |
parent | 2f57eee7dabd10ebd31afd30dbfd6f4752135859 (diff) | |
download | gitlab-ce-0910868d3cdd63d416f711df0f12ab67d4328130.tar.gz |
Tweak cycle analytics query to match the current requirements.
- The `review` phase ends when a MR is merged, not "merged OR closed".
- The `code` phase starts when a MR is first mentioned in a commit, and
ends when a merge request closing the issue is created.
- The `plan` phase ends when the issue first mentioned in a commit.
---
- Fix the `median` function so it sorts the incoming data points.
- A data point where `end_time` is prior to `start_time` is invalid.
Diffstat (limited to 'app/models/cycle_analytics')
-rw-r--r-- | app/models/cycle_analytics/queries.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/cycle_analytics/queries.rb b/app/models/cycle_analytics/queries.rb index 1a9a1daa2b0..7816c96a0ed 100644 --- a/app/models/cycle_analytics/queries.rb +++ b/app/models/cycle_analytics/queries.rb @@ -26,6 +26,14 @@ class CycleAnalytics end end + 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.map(&:committed_date).min if commits_mentioning_issue.present? + end + end + def merge_request_first_closed_at lambda do |data_point| merge_request = data_point[:merge_request] |