Improve speed of index query in projects overview service [SCI-3107]

This commit is contained in:
Oleksii Kriuchykhin 2019-02-28 17:46:34 +01:00
parent e0ef3781a8
commit 1fedb4c91e

View file

@ -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)