Cleanup carto save
This commit is contained in:
parent
38091963c1
commit
c6a28d1444
1 changed files with 5 additions and 5 deletions
|
@ -12,18 +12,18 @@ class Users::CarteController < UsersController
|
||||||
end
|
end
|
||||||
|
|
||||||
def save
|
def save
|
||||||
safe_json_latlngs = clean_json_latlngs(params[:json_latlngs])
|
geo_json = clean_json_latlngs(params[:selection])
|
||||||
dossier = current_user_dossier
|
dossier = current_user_dossier
|
||||||
|
|
||||||
dossier.quartier_prioritaires.each(&:destroy)
|
dossier.quartier_prioritaires.each(&:destroy)
|
||||||
dossier.cadastres.each(&:destroy)
|
dossier.cadastres.each(&:destroy)
|
||||||
|
|
||||||
if safe_json_latlngs.present?
|
if geo_json.present?
|
||||||
ModuleApiCartoService.save_qp! dossier, safe_json_latlngs
|
ModuleApiCartoService.save_qp! dossier, geo_json
|
||||||
ModuleApiCartoService.save_cadastre! dossier, safe_json_latlngs
|
ModuleApiCartoService.save_cadastre! dossier, geo_json
|
||||||
end
|
end
|
||||||
|
|
||||||
dossier.update(json_latlngs: safe_json_latlngs)
|
dossier.update!(json_latlngs: geo_json)
|
||||||
|
|
||||||
redirect_to brouillon_dossier_path(dossier)
|
redirect_to brouillon_dossier_path(dossier)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue