fix(administrateur): can be deleted only if other admin or dossiers on all procedures included with discarded

This commit is contained in:
Eric Leroy-Terquem 2024-03-18 16:20:23 +01:00
parent 7746f2d660
commit 6a77bbb6c9

View file

@ -69,7 +69,7 @@ class Administrateur < ApplicationRecord
end
def can_be_deleted?
procedures.all? { |p| p.administrateurs.count > 1 || p.dossiers.empty? }
procedures.with_discarded.all? { |p| p.administrateurs.count > 1 || p.dossiers.empty? }
end
def delete_and_transfer_services