Avoid n+1 because of gestionnaire.follows?(dossier)
This commit is contained in:
parent
d780ab1c90
commit
f3f2b6acc2
3 changed files with 7 additions and 2 deletions
|
@ -37,6 +37,11 @@ module NewGestionnaire
|
|||
.where(procedure: @procedure)
|
||||
.en_cours
|
||||
|
||||
@followed_dossiers_id = current_gestionnaire
|
||||
.followed_dossiers
|
||||
.where(procedure: @procedure)
|
||||
.pluck(:id)
|
||||
|
||||
@termines_dossiers = procedure.dossiers.includes(:user).termine
|
||||
|
||||
@all_state_dossiers = procedure.dossiers.includes(:user).all_state
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
- if dossier.en_construction_ou_instruction?
|
||||
- if current_gestionnaire.follow?(dossier)
|
||||
- if dossier_is_followed
|
||||
= link_to unfollow_dossier_path(procedure, dossier), method: :patch, class: 'button' do
|
||||
%i.unfollow>
|
||||
ne plus suivre
|
||||
|
|
|
@ -47,6 +47,6 @@
|
|||
%td.status-col
|
||||
= link_to(dossier_path(@procedure, dossier), class: 'big-link') do
|
||||
= render partial: 'status', locals: { dossier: dossier }
|
||||
%td.follow-col= render partial: 'dossier_actions', locals: { procedure: @procedure, dossier: dossier }
|
||||
%td.follow-col= render partial: 'dossier_actions', locals: { procedure: @procedure, dossier: dossier, dossier_is_followed: @followed_dossiers_id.include?(dossier.id) }
|
||||
- else
|
||||
%h2 Aucun dossier
|
||||
|
|
Loading…
Reference in a new issue