add action 'unfollow' to page 'suivis'

This commit is contained in:
Lisa Durand 2023-01-13 15:09:24 +01:00
parent 2f666b487e
commit 06c6a4ab0c
11 changed files with 119 additions and 5 deletions

View file

@ -21,7 +21,8 @@ class BatchOperation < ApplicationRecord
archiver: 'archiver',
follow: 'follow',
passer_en_instruction: 'passer_en_instruction',
repasser_en_construction: 'repasser_en_construction'
repasser_en_construction: 'repasser_en_construction',
unfollow: 'unfollow'
}
has_many :dossiers, dependent: :nullify
@ -64,6 +65,8 @@ class BatchOperation < ApplicationRecord
query.without_followers.en_cours
when BatchOperation.operations.fetch(:repasser_en_construction) then
query.state_en_instruction
when BatchOperation.operations.fetch(:unfollow) then
query.with_followers.en_cours
end
end
@ -84,6 +87,8 @@ class BatchOperation < ApplicationRecord
instructeur.follow(dossier)
when BatchOperation.operations.fetch(:repasser_en_construction)
dossier.repasser_en_construction!(instructeur: instructeur)
when BatchOperation.operations.fetch(:unfollow)
instructeur.unfollow(dossier)
end
end