Merge pull request #1543 from okriuchykhin/ok_SCI_3107

Improve speed of index query in projects overview service [SCI-3107]
This commit is contained in:
Alex Kriuchykhin 2019-03-01 13:53:56 +01:00 committed by GitHub
commit 09ed7922da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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)