procedures: fix double N+1 requests in new_from_existing

This commit is contained in:
Pierre de La Morinerie 2018-07-03 23:55:55 +02:00
parent b0a9e49549
commit 592331e9ac

View file

@ -185,6 +185,7 @@ class Admin::ProceduresController < AdminController
.pluck('procedures.id')
@grouped_procedures = Procedure
.includes(:administrateur, :service)
.where(id: significant_procedure_ids)
.group_by(&:organisation_name)
.sort_by { |_, procedures| procedures.first.created_at }