Skip to content

Commit

Permalink
te_fenua_champ: added export
Browse files Browse the repository at this point in the history
  • Loading branch information
maatinito committed Mar 26, 2024
1 parent 6934ec2 commit 68fcc41
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion app/models/champs/te_fenua_champ.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 68fcc41

Please sign in to comment.