chore(administrateur): destroy procedure if no administrateur and no dossier
This commit is contained in:
parent
ca413a1035
commit
eae149f49d
1 changed files with 4 additions and 0 deletions
|
@ -82,6 +82,10 @@ class Administrateur < ApplicationRecord
|
|||
|
||||
next_administrateur = procedure.administrateurs.where.not(id: self.id).first
|
||||
procedure.service.update(administrateur: next_administrateur)
|
||||
|
||||
if (procedure.administrateurs.count == 1 && procedure.dossiers.empty?)
|
||||
procedure.destroy
|
||||
end
|
||||
end
|
||||
|
||||
services.each do |service|
|
||||
|
|
Loading…
Reference in a new issue