diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2016-08-25 09:25:07 +0300 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2016-08-26 13:58:20 +0300 |
commit | 14d6317ebc756ee6b27a3a8cd39927238f6d757c (patch) | |
tree | 740864ad89ca36b966a05b148c0690e5b4a5c868 /app/models/cycle_analytics | |
parent | 487906b3861068a8f81125814f919a07bfab8469 (diff) |
Add the "Review" cycle analytics section.
Diffstat (limited to 'app/models/cycle_analytics')
-rw-r--r-- | app/models/cycle_analytics/queries.rb | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/app/models/cycle_analytics/queries.rb b/app/models/cycle_analytics/queries.rb index ec0311b91b5..41081a4e08c 100644 --- a/app/models/cycle_analytics/queries.rb +++ b/app/models/cycle_analytics/queries.rb @@ -3,13 +3,24 @@ class CycleAnalytics class << self def issue_first_associated_with_milestone_or_first_added_to_list_label_time lambda do |issue| - issue.metrics.first_associated_with_milestone_at.presence || issue.metrics.first_added_to_board_at.presence + if issue.metrics.present? + issue.metrics.first_associated_with_milestone_at.presence || + issue.metrics.first_added_to_board_at.presence + end + end + end + + def mr_first_closed_or_merged_at + lambda do |merge_request| + if merge_request.metrics.present? + merge_request.metrics.merged_at.presence || merge_request.metrics.first_closed_at.presence + end end end def issue_closing_merge_request_opened_time lambda do |issue| - merge_requests = issue.closed_by_merge_requests + merge_requests = issue.closed_by_merge_requests(nil, check_if_open: false) merge_requests.map(&:created_at).min if merge_requests.present? end end @@ -17,7 +28,8 @@ class CycleAnalytics def mr_wip_flag_removed_or_assigned_to_user_other_than_author_time lambda do |merge_request| if merge_request.metrics.present? - merge_request.metrics.wip_flag_first_removed_at || merge_request.metrics.first_assigned_to_user_other_than_author + merge_request.metrics.wip_flag_first_removed_at.presence || + merge_request.metrics.first_assigned_to_user_other_than_author.presence end end end |