Merge pull request #3071 from tchak/fix-champ-cart-again
Do not send error json to backend - it doesn’t need it and it creates bad data
This commit is contained in:
commit
d7b5030be9
3 changed files with 3 additions and 3 deletions
|
@ -28,7 +28,7 @@ class Champs::CarteController < ApplicationController
|
|||
geo_areas = []
|
||||
geo_json = geo_json.blank? ? [] : JSON.parse(geo_json)
|
||||
|
||||
if geo_json.first == ["error", "TooManyPolygons"]
|
||||
if geo_json.empty?
|
||||
@error = true
|
||||
@champ.value = nil
|
||||
@champ.geo_areas = []
|
||||
|
|
|
@ -115,7 +115,7 @@ export function addFreeDrawEvents(map, selector) {
|
|||
} else if (polygonArea(latLngs) < 300000) {
|
||||
input.value = JSON.stringify(latLngs);
|
||||
} else {
|
||||
input.value = '{ "error": "TooManyPolygons" }';
|
||||
input.value = '';
|
||||
}
|
||||
|
||||
fire(input, 'change');
|
||||
|
|
|
@ -50,7 +50,7 @@ describe Champs::CarteController, type: :controller do
|
|||
|
||||
context 'when error' do
|
||||
let(:geojson) { [[{ "lat": 48.87442541960633, "lng": 2.3859214782714844 }, { "lat": 48.87273183590832, "lng": 2.3850631713867183 }, { "lat": 48.87081237174292, "lng": 2.3809432983398438 }, { "lat": 48.8712640169951, "lng": 2.377510070800781 }, { "lat": 48.87510283703279, "lng": 2.3778533935546875 }, { "lat": 48.87544154230615, "lng": 2.382831573486328 }, { "lat": 48.87442541960633, "lng": 2.3859214782714844 }]] }
|
||||
let(:selection) { { error: "TooManyPolygons" } }
|
||||
let(:selection) { '' }
|
||||
|
||||
it {
|
||||
expect(champ.reload.value).to eq(nil)
|
||||
|
|
Loading…
Reference in a new issue