From 560146d88c0c8a49d723d63ce79a382b90431133 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Sat, 1 Feb 2025 20:09:38 +0300 Subject: [PATCH] Remove ids collected in parallel to model instances in map api --- app/controllers/api/maps_controller.rb | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/app/controllers/api/maps_controller.rb b/app/controllers/api/maps_controller.rb index 2aa25fdd7..c37ba2a3e 100644 --- a/app/controllers/api/maps_controller.rb +++ b/app/controllers/api/maps_controller.rb @@ -57,26 +57,18 @@ module Api nodes += Node.includes(:node_tags).find(nodes_to_fetch) unless nodes_to_fetch.empty? - visible_nodes = {} @nodes = [] nodes.each do |node| - if node.visible? - visible_nodes[node.id] = node - @nodes << node - end + @nodes << node if node.visible? end @ways = [] - way_ids = [] ways.each do |way| - if way.visible? - way_ids << way.id - @ways << way - end + @ways << way if way.visible? end - @relations = Relation.nodes(visible_nodes.keys).visible + - Relation.ways(way_ids).visible + @relations = Relation.nodes(@nodes).visible + + Relation.ways(@ways).visible # we do not normally return the "other" partners referenced by an relation, # e.g. if we return a way A that is referenced by relation X, and there's -- 2.39.5