summaryrefslogtreecommitdiff
path: root/app/models/cycle_analytics
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2016-08-26 16:18:52 +0530
committerTimothy Andrew <mail@timothyandrew.net>2016-08-26 16:28:20 +0530
commit331080bca683fdab73520f68c53f6a5367d17f22 (patch)
tree2aaf99f087b86c25fe7e0d25feb22f501437bdf9 /app/models/cycle_analytics
parentce6bcdd0043caf267d5d4478d45741aa4ecf1ac9 (diff)
downloadgitlab-ce-331080bca683fdab73520f68c53f6a5367d17f22.tar.gz
Fetch cycle analytics data for a specific date range.
1. Supported date ranges are 30 / 90 days ago. The default is 90 days ago. 2. All issues created before "x days ago" are filtered out, even if they have other related data (test runs, merge requests) within the filter range.
Diffstat (limited to 'app/models/cycle_analytics')
-rw-r--r--app/models/cycle_analytics/queries.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/models/cycle_analytics/queries.rb b/app/models/cycle_analytics/queries.rb
index 122b2599bd3..1a9a1daa2b0 100644
--- a/app/models/cycle_analytics/queries.rb
+++ b/app/models/cycle_analytics/queries.rb
@@ -1,12 +1,12 @@
class CycleAnalytics
module Queries
class << self
- def issues(project)
- project.issues.map { |issue| { issue: issue } }
+ def issues(project, created_after:)
+ project.issues.where("created_at >= ?", created_after).map { |issue| { issue: issue } }
end
- def merge_requests_closing_issues(project)
- issues(project).map do |data_point|
+ def merge_requests_closing_issues(project, options = {})
+ issues(project, options).map do |data_point|
merge_requests = data_point[:issue].closed_by_merge_requests(nil, check_if_open: false)
merge_requests.map { |merge_request| { issue: data_point[:issue], merge_request: merge_request } }
end.flatten