add action 'repasser en construction' to page 'suivis'

This commit is contained in:
Lisa Durand 2023-01-11 11:05:19 +01:00
parent 65e125b4ec
commit 2f666b487e
10 changed files with 116 additions and 5 deletions

View file

@ -20,7 +20,8 @@ class BatchOperation < ApplicationRecord
accepter: 'accepter',
archiver: 'archiver',
follow: 'follow',
passer_en_instruction: 'passer_en_instruction'
passer_en_instruction: 'passer_en_instruction',
repasser_en_construction: 'repasser_en_construction'
}
has_many :dossiers, dependent: :nullify
@ -61,6 +62,8 @@ class BatchOperation < ApplicationRecord
query.state_en_instruction
when BatchOperation.operations.fetch(:follow) then
query.without_followers.en_cours
when BatchOperation.operations.fetch(:repasser_en_construction) then
query.state_en_instruction
end
end
@ -79,6 +82,8 @@ class BatchOperation < ApplicationRecord
dossier.accepter(instructeur: instructeur, motivation: motivation, justificatif: justificatif_motivation)
when BatchOperation.operations.fetch(:follow)
instructeur.follow(dossier)
when BatchOperation.operations.fetch(:repasser_en_construction)
dossier.repasser_en_construction!(instructeur: instructeur)
end
end