Use filter instead of loop in visible node/way collections
This commit is contained in:
parent
560146d88c
commit
b9f1e31122
1 changed files with 2 additions and 8 deletions
|
@ -57,15 +57,9 @@ module Api
|
|||
|
||||
nodes += Node.includes(:node_tags).find(nodes_to_fetch) unless nodes_to_fetch.empty?
|
||||
|
||||
@nodes = []
|
||||
nodes.each do |node|
|
||||
@nodes << node if node.visible?
|
||||
end
|
||||
@nodes = nodes.filter(&:visible?)
|
||||
|
||||
@ways = []
|
||||
ways.each do |way|
|
||||
@ways << way if way.visible?
|
||||
end
|
||||
@ways = ways.filter(&:visible?)
|
||||
|
||||
@relations = Relation.nodes(@nodes).visible +
|
||||
Relation.ways(@ways).visible
|
||||
|
|
Loading…
Add table
Reference in a new issue