add bulk action 'follow'

This commit is contained in:
Lisa Durand 2023-01-04 11:51:22 +01:00
parent 177dec2bdb
commit 25a7fa5a34
10 changed files with 126 additions and 5 deletions

View file

@ -17,9 +17,10 @@
class BatchOperation < ApplicationRecord
enum operation: {
accepter: 'accepter',
archiver: 'archiver',
passer_en_instruction: 'passer_en_instruction',
accepter: 'accepter'
follow: 'follow',
passer_en_instruction: 'passer_en_instruction'
}
has_many :dossiers, dependent: :nullify
@ -58,6 +59,8 @@ class BatchOperation < ApplicationRecord
query.state_en_construction
when BatchOperation.operations.fetch(:accepter) then
query.state_en_instruction
when BatchOperation.operations.fetch(:follow) then
query.without_followers
end
end
@ -74,6 +77,8 @@ class BatchOperation < ApplicationRecord
dossier.passer_en_instruction(instructeur: instructeur)
when BatchOperation.operations.fetch(:accepter)
dossier.accepter(instructeur: instructeur, motivation: motivation, justificatif: justificatif_motivation)
when BatchOperation.operations.fetch(:follow)
instructeur.follow(dossier)
end
end