diff options
author | Gosia Ksionek <mksionek@gitlab.com> | 2019-08-05 21:15:00 +0000 |
---|---|---|
committer | Mayra Cabrera <mcabrera@gitlab.com> | 2019-08-05 21:15:00 +0000 |
commit | 6c5e9480130308abf9458f1ac58e25695c5ce2ea (patch) | |
tree | 12734828967ba9637d7f87cff3097a4e48cd1b30 /lib/gitlab/cycle_analytics/issue_helper.rb | |
parent | 1dfbb27f6e8d01023564eededff2a0ba1a04badc (diff) | |
download | gitlab-ce-6c5e9480130308abf9458f1ac58e25695c5ce2ea.tar.gz |
Fix error on project name
Add project path to sql query to build proper path
Diffstat (limited to 'lib/gitlab/cycle_analytics/issue_helper.rb')
-rw-r--r-- | lib/gitlab/cycle_analytics/issue_helper.rb | 13 |
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 |