From 1fedb4c91eca1b3229ebcf753ec0bb01b4783f32 Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Thu, 28 Feb 2019 17:46:34 +0100 Subject: [PATCH] Improve speed of index query in projects overview service [SCI-3107] --- app/services/projects_overview_service.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/services/projects_overview_service.rb b/app/services/projects_overview_service.rb index 51d578234..a189488d4 100644 --- a/app/services/projects_overview_service.rb +++ b/app/services/projects_overview_service.rb @@ -72,6 +72,7 @@ class ProjectsOverviewService .joins('LEFT OUTER JOIN user_projects ON '\ 'user_projects.project_id = projects.id') .left_outer_joins(:user_my_modules) + .where('projects.id': @team.projects) .where('user_my_modules.user_id = :user_id '\ 'OR (user_projects.role = 0 '\ 'AND user_projects.user_id = :user_id)', user_id: @user.id)