Test and fix all possible cases of champ carte serialization
This commit is contained in:
parent
c2161fbf85
commit
097a15d624
3 changed files with 108 additions and 42 deletions
|
@ -12,11 +12,9 @@ class ChampSerializer < ActiveModel::Serializer
|
|||
def value
|
||||
case object
|
||||
when GeoArea
|
||||
object.geometry
|
||||
object.geometry.to_json
|
||||
when Champs::CarteChamp
|
||||
if object.value.present?
|
||||
JSON.parse(object.value)
|
||||
end
|
||||
object.user_geometry.to_json
|
||||
when Champs::DecimalNumberChamp
|
||||
if object.value.present?
|
||||
object.value.to_f
|
||||
|
@ -71,7 +69,7 @@ class ChampSerializer < ActiveModel::Serializer
|
|||
libelle: legacy_carto_libelle,
|
||||
type_champ: legacy_carto_type_champ,
|
||||
order_place: -1,
|
||||
descripton: ''
|
||||
description: ''
|
||||
}
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue