Merge pull request #9337 from demarches-simplifiees/fix-procedure-query-for-instructeur-tabs

[fix] Les demarches supprimées s'affichent encore dans l'onglet "en test" pour les instructeurs
This commit is contained in:
Paul Chavard 2023-07-24 09:11:01 +00:00 committed by GitHub
commit a492d7f41e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,19 +7,19 @@ module Instructeurs
BATCH_SELECTION_LIMIT = 500
def index
@procedures = current_instructeur
all_procedures = current_instructeur
.procedures
.kept
.with_attached_logo
.includes(:defaut_groupe_instructeur)
.order(closed_at: :desc, unpublished_at: :desc, published_at: :desc, created_at: :desc)
@procedures_publiees = paginated_published_procedures
@procedures_draft = paginated_draft_procedures
@procedures_closed = paginated_closed_procedures
@procedures_publiees_count = current_instructeur.procedures.publiees.count
@procedures_draft_count = current_instructeur.procedures.brouillons.count
@procedures_closed_count = current_instructeur.procedures.closes.count
@procedures = all_procedures.order(closed_at: :desc, unpublished_at: :desc, published_at: :desc, created_at: :desc)
@procedures_publiees = all_procedures.publiees.order(published_at: :desc).page(params[:page]).per(ITEMS_PER_PAGE)
@procedures_draft = all_procedures.brouillons.order(created_at: :desc).page(params[:page]).per(ITEMS_PER_PAGE)
@procedures_closed = all_procedures.closes.order(created_at: :desc).page(params[:page]).per(ITEMS_PER_PAGE)
@procedures_publiees_count = all_procedures.publiees.count
@procedures_draft_count = all_procedures.brouillons.count
@procedures_closed_count = all_procedures.closes.count
dossiers = current_instructeur.dossiers
.joins(groupe_instructeur: :procedure)
@ -58,33 +58,6 @@ module Instructeurs
@statut.blank? ? @statut = 'publiees' : @statut = params[:statut]
end
def paginated_published_procedures
current_instructeur
.procedures
.publiees
.page(params[:page])
.per(ITEMS_PER_PAGE)
.order(published_at: :desc)
end
def paginated_draft_procedures
current_instructeur
.procedures
.brouillons
.page(params[:page])
.per(ITEMS_PER_PAGE)
.order(created_at: :desc)
end
def paginated_closed_procedures
current_instructeur
.procedures
.closes
.page(params[:page])
.per(ITEMS_PER_PAGE)
.order(created_at: :desc)
end
def show
@procedure = procedure
# Technically, procedure_presentation already sets the attribute.