Stop using legacy api carto after migration

This commit is contained in:
Paul Chavard 2018-10-31 11:32:41 +01:00
parent 44ca6a2d02
commit 2462e42b53
8 changed files with 14 additions and 8 deletions

View file

@ -245,6 +245,10 @@ class Dossier < ApplicationRecord
end
end
def use_legacy_carto?
procedure.use_legacy_carto?
end
def user_geometry
if json_latlngs.present?
UserGeometry.new(json_latlngs)

View file

@ -30,8 +30,6 @@ class Procedure < ApplicationRecord
has_one_attached :notice
has_one_attached :deliberation
delegate :use_api_carto, to: :module_api_carto
accepts_nested_attributes_for :types_de_champ, :reject_if => proc { |attributes| attributes['libelle'].blank? }, :allow_destroy => true
accepts_nested_attributes_for :types_de_piece_justificative, :reject_if => proc { |attributes| attributes['libelle'].blank? }, :allow_destroy => true
accepts_nested_attributes_for :module_api_carto
@ -133,6 +131,10 @@ class Procedure < ApplicationRecord
publiee? || archivee?
end
def use_legacy_carto?
module_api_carto.use_api_carto? && !module_api_carto.migrated?
end
# Warning: dossier after_save build_default_champs must be removed
# to save a dossier created from this method
def new_dossier