cannot publish a procedure if no zones

This commit is contained in:
Christophe Robillard 2022-09-27 19:46:50 +02:00 committed by krichtof
parent bdcb451d3c
commit 272c8cae09
3 changed files with 78 additions and 5 deletions

View file

@ -629,6 +629,10 @@ class Procedure < ApplicationRecord
result << :instructeurs
end
if missing_zones?
result << :zones
end
result
end
@ -661,6 +665,14 @@ class Procedure < ApplicationRecord
!AssignTo.exists?(groupe_instructeur: groupe_instructeurs)
end
def missing_zones?
if Flipper.enabled?(:zonage)
zones.empty?
else
false
end
end
def revised?
feature_enabled?(:procedure_revisions) && revisions.size > 2
end