Merge pull request #10928 from colinux/perf-admin-index
ETQ admin, améliore un peu la vitesse de chargement de la liste des démarches
This commit is contained in:
commit
bac54ba214
2 changed files with 43 additions and 39 deletions
|
@ -24,43 +24,6 @@ module Administrateurs
|
|||
@statut.blank? ? @statut = 'publiees' : @statut = params[:statut]
|
||||
end
|
||||
|
||||
def paginated_published_procedures
|
||||
current_administrateur
|
||||
.procedures
|
||||
.publiees
|
||||
.page(params[:page])
|
||||
.per(ITEMS_PER_PAGE)
|
||||
.order(published_at: :desc)
|
||||
end
|
||||
|
||||
def paginated_draft_procedures
|
||||
current_administrateur
|
||||
.procedures
|
||||
.brouillons
|
||||
.page(params[:page])
|
||||
.per(ITEMS_PER_PAGE)
|
||||
.order(created_at: :desc)
|
||||
end
|
||||
|
||||
def paginated_closed_procedures
|
||||
current_administrateur
|
||||
.procedures
|
||||
.closes
|
||||
.page(params[:page])
|
||||
.per(ITEMS_PER_PAGE)
|
||||
.order(created_at: :desc)
|
||||
end
|
||||
|
||||
def paginated_deleted_procedures
|
||||
current_administrateur
|
||||
.procedures
|
||||
.with_discarded
|
||||
.discarded
|
||||
.page(params[:page])
|
||||
.per(ITEMS_PER_PAGE)
|
||||
.order(created_at: :desc)
|
||||
end
|
||||
|
||||
def apercu
|
||||
@dossier = procedure_without_control.draft_revision.dossier_for_preview(current_user)
|
||||
DossierPreloader.load_one(@dossier)
|
||||
|
@ -464,6 +427,47 @@ module Administrateurs
|
|||
|
||||
private
|
||||
|
||||
def paginated_published_procedures
|
||||
paginate_procedures(current_administrateur
|
||||
.procedures
|
||||
.publiees
|
||||
.order(published_at: :desc))
|
||||
end
|
||||
|
||||
def paginated_draft_procedures
|
||||
paginate_procedures(current_administrateur
|
||||
.procedures
|
||||
.brouillons
|
||||
.order(created_at: :desc))
|
||||
end
|
||||
|
||||
def paginated_closed_procedures
|
||||
paginate_procedures(current_administrateur
|
||||
.procedures
|
||||
.closes
|
||||
.order(created_at: :desc))
|
||||
end
|
||||
|
||||
def paginated_deleted_procedures
|
||||
paginate_procedures(current_administrateur
|
||||
.procedures
|
||||
.with_discarded
|
||||
.discarded
|
||||
.order(created_at: :desc))
|
||||
end
|
||||
|
||||
def paginate_procedures(procedures)
|
||||
procedures
|
||||
.with_attached_logo
|
||||
.left_joins(groupe_instructeurs: :instructeurs)
|
||||
.select('procedures.*,
|
||||
COUNT(DISTINCT groupe_instructeurs.id) AS groupe_instructeurs_count,
|
||||
COUNT(DISTINCT instructeurs.id) AS instructeurs_count')
|
||||
.group('procedures.id')
|
||||
.page(params[:page])
|
||||
.per(ITEMS_PER_PAGE)
|
||||
end
|
||||
|
||||
def filter_procedures(filter)
|
||||
if filter.service_siret.present?
|
||||
service = Service.find_by(siret: filter.service_siret)
|
||||
|
|
|
@ -45,9 +45,9 @@
|
|||
%div
|
||||
= dsfr_icon('fr-icon-team-fill')
|
||||
- if procedure.routing_enabled?
|
||||
%span.fr-badge= procedure.groupe_instructeurs.count
|
||||
%span.fr-badge= procedure.groupe_instructeurs_count
|
||||
- else
|
||||
%span.fr-badge= procedure.instructeurs.count
|
||||
%span.fr-badge= procedure.instructeurs_count
|
||||
|
||||
= dsfr_icon('fr-icon-file-text-fill fr-ml-1w')
|
||||
%span.fr-badge= procedure.dossiers.state_not_brouillon.visible_by_administration.count
|
||||
|
|
Loading…
Reference in a new issue