Skip to content

Commit

Permalink
Merge pull request #9337 from demarches-simplifiees/fix-procedure-que…
Browse files Browse the repository at this point in the history
…ry-for-instructeur-tabs

[fix] Les demarches supprimées s'affichent encore dans l'onglet "en test" pour les instructeurs
  • Loading branch information
tchak authored Jul 24, 2023
2 parents c4dfd45 + 312c792 commit a492d7f
Showing 1 changed file with 8 additions and 35 deletions.
43 changes: 8 additions & 35 deletions app/controllers/instructeurs/procedures_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ class ProceduresController < InstructeurController
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)
Expand Down Expand Up @@ -58,33 +58,6 @@ def index
@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.
Expand Down

0 comments on commit a492d7f

Please sign in to comment.