diff --git a/app/models/champs/te_fenua_champ.rb b/app/models/champs/te_fenua_champ.rb index ac1d3164093..4c326da8104 100644 --- a/app/models/champs/te_fenua_champ.rb +++ b/app/models/champs/te_fenua_champ.rb @@ -104,6 +104,19 @@ def for_api end def for_export - nil + geo_json_from_value&.map do |k, v| + case k + when :parcelles + for_each_feature(v) { |_f, p| "Parcelle n°#{p[:sec_parcelle]} - #{p[:surface_adop]} m2 - #{p[:terre]} à #{p[:commune]} (#{p[:ile]})" } + when :zones_manuelles + for_each_feature(v) { |f, p| "#{f[:id]} à #{p[:commune]} (#{p[:ile]})" } + end + end&.join("\r\n") + end + + def for_each_feature(value) + value[:features].map do |f| + yield f, f[:properties] + end.join("\r\n") end end