summaryrefslogtreecommitdiff
path: root/lib/gitlab/cycle_analytics/issue_helper.rb
diff options
context:
space:
mode:
authorSimon Knox <psimyn@gmail.com>2019-08-06 15:07:18 +1000
committerSimon Knox <psimyn@gmail.com>2019-08-06 15:07:18 +1000
commitfc77b9df8b6a49c86e9c1eb949f1b1162470d2ee (patch)
tree96aad0a31543fa520626dc1c5efabff1367a0bab /lib/gitlab/cycle_analytics/issue_helper.rb
parent9c71bf3e6df2dcb20ea19df21a127823bbe5e615 (diff)
parentfa216b0e86433192ba4e39a05f42217fb4685173 (diff)
downloadgitlab-ce-alerts-dropdown-to-modal-part-2-ce.tar.gz
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into alerts-dropdown-to-modal-part-2-cealerts-dropdown-to-modal-part-2-ce
Diffstat (limited to 'lib/gitlab/cycle_analytics/issue_helper.rb')
-rw-r--r--lib/gitlab/cycle_analytics/issue_helper.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/gitlab/cycle_analytics/issue_helper.rb b/lib/gitlab/cycle_analytics/issue_helper.rb
index 0fc4f1dd41a..295eca5edca 100644
--- a/lib/gitlab/cycle_analytics/issue_helper.rb
+++ b/lib/gitlab/cycle_analytics/issue_helper.rb
@@ -8,12 +8,19 @@ module Gitlab
.join(projects_table).on(issue_table[:project_id].eq(projects_table[:id]))
.join(routes_table).on(projects_table[:namespace_id].eq(routes_table[:source_id]))
.project(issue_table[:project_id].as("project_id"))
- .where(issue_table[:project_id].in(project_ids))
+ .project(projects_table[:path].as("project_path"))
+ .project(routes_table[:path].as("namespace_path"))
+
+ query = limit_query(query, project_ids)
+
+ query
+ end
+
+ def limit_query(query, project_ids)
+ query.where(issue_table[:project_id].in(project_ids))
.where(routes_table[:source_type].eq('Namespace'))
.where(issue_table[:created_at].gteq(options[:from]))
.where(issue_metrics_table[:first_added_to_board_at].not_eq(nil).or(issue_metrics_table[:first_associated_with_milestone_at].not_eq(nil)))
-
- query
end
end
end