You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is causing a couple N+1. That's because for every question we call Decidim's Question#publishable_results? which in turn calls consultation.finished? and responses.order(votes_count: :desc).
https://github.com/coopdevs/decidim-module-action_delegator/blob/1c22b438cbd51afcc7ac4cfb41bc70deacb94f5f/app/views/decidim/action_delegator/admin/consultations/results.html.erb#L40
Is causing a couple N+1. That's because for every question we call Decidim's
Question#publishable_results?
which in turn callsconsultation.finished?
andresponses.order(votes_count: :desc)
.This results in the following logs
Proposed solution
The solution is to eager load both the consultation and the responses as part of the query performed from https://github.com/coopdevs/decidim-module-action_delegator/pull/106/files#diff-3e9e68c68f5a828e175f3957f398f80a95e20967f772bfe6be7aba260c01db36R59-R70. At this point, that method should probably be renamed to
#results_query
. It reaches out to many more tables than justquestions
.The text was updated successfully, but these errors were encountered: