Merge pull request #9023 from mfo/US/clarify-counters

amelioration(instructeurs/procedure#show): ETQ instructeur, je souhaite avoir les mêmes compteurs entreles pages listant mes demarches et la page pour visualiser une démarches
This commit is contained in:
LeSim 2023-05-10 10:03:11 +00:00 committed by GitHub
commit 4cde60ce2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 12 deletions

View file

@ -17,13 +17,12 @@ module Instructeurs
dossiers = current_instructeur.dossiers dossiers = current_instructeur.dossiers
.joins(groupe_instructeur: :procedure) .joins(groupe_instructeur: :procedure)
.where(procedures: { hidden_at: nil }) .where(procedures: { hidden_at: nil })
dossiers_visibles = dossiers.visible_by_administration @dossiers_count_per_procedure = dossiers.by_statut('tous').group('groupe_instructeurs.procedure_id').reorder(nil).count
@dossiers_count_per_procedure = dossiers_visibles.all_state.group('groupe_instructeurs.procedure_id').reorder(nil).count @dossiers_a_suivre_count_per_procedure = dossiers.by_statut('a-suivre').group('groupe_instructeurs.procedure_id').reorder(nil).count
@dossiers_a_suivre_count_per_procedure = dossiers_visibles.without_followers.en_cours.group('groupe_instructeurs.procedure_id').reorder(nil).count @dossiers_archived_count_per_procedure = dossiers.by_statut('archives').group('groupe_instructeurs.procedure_id').count
@dossiers_archived_count_per_procedure = dossiers_visibles.archived.group('groupe_instructeurs.procedure_id').count @dossiers_termines_count_per_procedure = dossiers.by_statut('traites').group('groupe_instructeurs.procedure_id').reorder(nil).count
@dossiers_termines_count_per_procedure = dossiers_visibles.termine.group('groupe_instructeurs.procedure_id').reorder(nil).count @dossiers_expirant_count_per_procedure = dossiers.by_statut('expirant').group('groupe_instructeurs.procedure_id').count
@dossiers_expirant_count_per_procedure = dossiers_visibles.termine_or_en_construction_close_to_expiration.group('groupe_instructeurs.procedure_id').count @dossiers_supprimes_recemment_count_per_procedure = dossiers.by_statut('supprimes_recemment').group('groupe_instructeurs.procedure_id').reorder(nil).count
@dossiers_supprimes_recemment_count_per_procedure = dossiers.hidden_by_administration.group('groupe_instructeurs.procedure_id').reorder(nil).count
groupe_ids = current_instructeur.groupe_instructeurs.pluck(:id) groupe_ids = current_instructeur.groupe_instructeurs.pluck(:id)
@followed_dossiers_count_per_procedure = current_instructeur @followed_dossiers_count_per_procedure = current_instructeur

View file

@ -423,7 +423,7 @@ class Dossier < ApplicationRecord
.distinct .distinct
end end
scope :by_statut, -> (instructeur, statut = 'tous') do scope :by_statut, -> (statut, instructeur = nil) do
case statut case statut
when 'a-suivre' when 'a-suivre'
visible_by_administration visible_by_administration

View file

@ -231,7 +231,7 @@ class ProcedurePresentation < ApplicationRecord
end end
def filtered_sorted_ids(dossiers, statut, count: nil) def filtered_sorted_ids(dossiers, statut, count: nil)
dossiers_by_statut = dossiers.by_statut(instructeur, statut) dossiers_by_statut = dossiers.by_statut(statut, instructeur)
dossiers_sorted_ids = self.sorted_ids(dossiers_by_statut, count || dossiers_by_statut.size) dossiers_sorted_ids = self.sorted_ids(dossiers_by_statut, count || dossiers_by_statut.size)
if filters[statut].present? if filters[statut].present?

View file

@ -40,7 +40,7 @@
= t('views.instructeurs.dossiers.tab_explainations.tous') = t('views.instructeurs.dossiers.tab_explainations.tous')
- if @statut == 'supprimes_recemment' - if @statut == 'supprimes_recemment'
%p %p
= t('views.instructeurs.dossiers.tab_explainations.supprimes_recemment') = t('views.instructeurs.dossiers.tab_explainations.supprimes_recemment').html_safe
- if @statut == 'archives' - if @statut == 'archives'
%p %p
= t('views.instructeurs.dossiers.tab_explainations.archives') = t('views.instructeurs.dossiers.tab_explainations.archives')

View file

@ -358,7 +358,7 @@ en:
suivis: The folders that are in this tab are only those that you follow. You can exchange with the requester until you can accept them, refuse them or classify them without follow-up. suivis: The folders that are in this tab are only those that you follow. You can exchange with the requester until you can accept them, refuse them or classify them without follow-up.
traites_html: "The files in this tab are finished: they have been accepted, refused or closed without follow-up. You can <a href=%{archives_path}>download</a> the zip archives of finished files and their attachments." traites_html: "The files in this tab are finished: they have been accepted, refused or closed without follow-up. You can <a href=%{archives_path}>download</a> the zip archives of finished files and their attachments."
tous: All the files that have been submitted on this approach, regardless of the status. tous: All the files that have been submitted on this approach, regardless of the status.
supprimes_recemment: All files completed and deleted by the instructors on this approach. supprimes_recemment: All files not <strong>archive</strong>, <strong>completed</strong> and <strong>deleted by the instructors</strong> on this approach.
archives: "The files in this tab are archived: you can no longer reply to them, and requesters can no longer modify them." archives: "The files in this tab are archived: you can no longer reply to them, and requesters can no longer modify them."
expirant: Records will not expire prior to the data retention period. expirant: Records will not expire prior to the data retention period.
archived_dossier: "This file will be kept for an additional month" archived_dossier: "This file will be kept for an additional month"

View file

@ -358,7 +358,7 @@ fr:
suivis: Les dossiers qui sont dans cet onglet sont uniquement ceux que vous suivez. Vous pouvez échanger avec le demandeur jusquà pouvoir les accepter, les refuser ou les classer sans suite. suivis: Les dossiers qui sont dans cet onglet sont uniquement ceux que vous suivez. Vous pouvez échanger avec le demandeur jusquà pouvoir les accepter, les refuser ou les classer sans suite.
traites_html: "Les dossiers dans cet onglet sont terminés : ils ont été acceptés, refusés ou classés sans suite. Vous pouvez <a href=%{archives_path}>télécharger</a> les archives au format zip des dossiers terminés et leurs pièces jointes." traites_html: "Les dossiers dans cet onglet sont terminés : ils ont été acceptés, refusés ou classés sans suite. Vous pouvez <a href=%{archives_path}>télécharger</a> les archives au format zip des dossiers terminés et leurs pièces jointes."
tous: Tous les dossiers qui ont été déposés sur cette démarche, quel que soit le statut. tous: Tous les dossiers qui ont été déposés sur cette démarche, quel que soit le statut.
supprimes_recemment: Tous les dossiers terminés et supprimés par les instructeurs sur cette démarche supprimes_recemment: Tous les dossiers <strong>non archivés</strong>, <strong>terminés</strong> et <strong>supprimés par les instructeurs</strong> sur cette démarche
archives: "Les dossiers de cet onglet sont archivés : vous ne pouvez plus y répondre, et les demandeurs ne peuvent plus les modifier." archives: "Les dossiers de cet onglet sont archivés : vous ne pouvez plus y répondre, et les demandeurs ne peuvent plus les modifier."
expirant: Les dossiers nexpireront pas avant la période de conservation des données. expirant: Les dossiers nexpireront pas avant la période de conservation des données.
archived_dossier: "Le dossier sera conservé 1 mois supplémentaire" archived_dossier: "Le dossier sera conservé 1 mois supplémentaire"