PERF: Avoid tags N+1 in assigned topic lists

This commit is contained in:
Ahmed Gagan 2020-08-04 20:55:38 +05:30 committed by GitHub
parent 6dbf3e2bcb
commit 8a77c932a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -217,6 +217,7 @@ after_initialize do
WHERE name = 'assigned_to_id'
AND value = ?)
", user.id.to_s)
.includes(:tags)
list = apply_ordering(list, options)
@ -257,6 +258,7 @@ after_initialize do
WHERE name = 'assigned_to_id'
AND value IN (SELECT user_id::varchar(255) from group_users where group_id = ?))
", group.id.to_s)
.includes(:tags)
list = apply_ordering(list, options)