refactor(dossier): improuve dossiers_safe_scope on batch operation

This commit is contained in:
Paul Chavard 2022-12-13 15:52:32 +01:00
parent 22a36c18ff
commit ece70efbea

View file

@ -40,10 +40,10 @@ class BatchOperation < ApplicationRecord
}
def dossiers_safe_scope(dossier_ids = self.dossier_ids)
query = Dossier.joins(:procedure)
.where(procedure: { id: instructeur.procedures.ids })
.where(id: dossier_ids)
query = instructeur
.dossiers
.visible_by_administration
.where(id: dossier_ids)
case operation
when BatchOperation.operations.fetch(:archiver) then
query.not_archived.state_termine