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 :label, uniqueness: { scope: :procedure }
|
||||||
validates :closed, acceptance: { accept: [false] }, if: -> do
|
validates :closed, acceptance: { accept: [false] }, if: -> do
|
||||||
if closed
|
if closed
|
||||||
other_groupes = procedure.groupe_instructeurs - [self]
|
(other_groupe_instructeurs.map(&:closed) + [closed]).all?
|
||||||
|
|
||||||
(other_groupes.map(&:closed) + [closed]).all?
|
|
||||||
else
|
else
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
@ -92,6 +90,10 @@ class GroupeInstructeur < ApplicationRecord
|
||||||
!routing_rule_matches_tdc?
|
!routing_rule_matches_tdc?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def other_groupe_instructeurs
|
||||||
|
procedure.groupe_instructeurs - [self]
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def routing_rule_matches_tdc?
|
def routing_rule_matches_tdc?
|
||||||
|
|
Loading…
Add table
Reference in a new issue