refactor(groupe instructeur): extract method other_groupe_instructeurs
This commit is contained in:
parent
908e531057
commit
e78c22f33c
1 changed files with 5 additions and 3 deletions
|
@ -27,9 +27,7 @@ class GroupeInstructeur < ApplicationRecord
|
|||
validates :label, uniqueness: { scope: :procedure }
|
||||
validates :closed, acceptance: { accept: [false] }, if: -> do
|
||||
if closed
|
||||
other_groupes = procedure.groupe_instructeurs - [self]
|
||||
|
||||
(other_groupes.map(&:closed) + [closed]).all?
|
||||
(other_groupe_instructeurs.map(&:closed) + [closed]).all?
|
||||
else
|
||||
false
|
||||
end
|
||||
|
@ -92,6 +90,10 @@ class GroupeInstructeur < ApplicationRecord
|
|||
!routing_rule_matches_tdc?
|
||||
end
|
||||
|
||||
def other_groupe_instructeurs
|
||||
procedure.groupe_instructeurs - [self]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def routing_rule_matches_tdc?
|
||||
|
|
Loading…
Reference in a new issue