Better handle empty user selection layers

This commit is contained in:
Paul Chavard 2018-10-22 14:17:30 +02:00
parent 4249f8ae25
commit c8c75fc254
4 changed files with 21 additions and 4 deletions

View file

@ -26,11 +26,11 @@ class Champs::CarteController < ApplicationController
end
geo_areas = []
geo_json = JSON.parse(geo_json)
geo_json = geo_json.blank? ? [] : JSON.parse(geo_json)
if geo_json.first == ["error", "TooManyPolygons"]
@error = true
else
elsif geo_json.present?
if @champ.cadastres?
cadastres = ModuleApiCartoService.generate_cadastre(geo_json)
geo_areas += cadastres.map do |cadastre|