display dossiers count for each procedure

This commit is contained in:
Christophe Robillard 2023-01-03 14:58:46 +01:00
parent c5acd82e6e
commit 9bab4f9d76
3 changed files with 4 additions and 2 deletions

View file

@ -418,7 +418,7 @@ module Administrateurs
procedures_result = procedures_result.where('unaccent(libelle) ILIKE unaccent(?)', "%#{filter.libelle}%") if filter.libelle.present?
procedures_sql = procedures_result.to_sql
sql = "select id, libelle, published_at, aasm_state, count(administrateurs_procedures.administrateur_id) as admin_count from administrateurs_procedures inner join procedures on procedures.id = administrateurs_procedures.procedure_id where procedures.id in (#{procedures_sql}) group by procedures.id order by published_at desc"
sql = "select id, libelle, published_at, aasm_state, estimated_dossiers_count, count(administrateurs_procedures.administrateur_id) as admin_count from administrateurs_procedures inner join procedures on procedures.id = administrateurs_procedures.procedure_id where procedures.id in (#{procedures_sql}) group by procedures.id order by published_at desc"
ActiveRecord::Base.connection.execute(sql)
end

View file

@ -8,6 +8,7 @@
%td= procedure.libelle
%td= procedure.id
%td= procedure.estimated_dossiers_count
%td= procedure.administrateurs.count
%td= t procedure.aasm_state, scope: 'activerecord.attributes.procedure.aasm_state'
%td= l(procedure.published_at, format: :message_date_without_time)
@ -16,7 +17,7 @@
- if show_detail
%tr.procedure{ id: "procedure_detail_#{procedure.id}" }
%td.fr-highlight--beige-gris-galet{ colspan: '7' }
%td.fr-highlight--beige-gris-galet{ colspan: '8' }
.fr-container
.fr-grid-row
.fr-col-6

View file

@ -41,6 +41,7 @@
%th{ scope: 'col' }
%th{ scope: 'col' } Démarche
%th{ scope: 'col' } №
%th{ scope: 'col' } Dossiers
%th{ scope: 'col' } Administrateurs
%th{ scope: 'col' } Statut
%th{ scope: 'col' } Date