more madness

This commit is contained in:
Steve Coast 2008-03-21 20:21:49 +00:00
parent 740511066f
commit 1f857565a6
2 changed files with 28 additions and 26 deletions

View file

@ -123,7 +123,7 @@ class AmfController < ApplicationController
points = nodes_not_used_in_area.collect { |n| [n.id, n.lon_potlatch(baselong,masterscale), n.lat_potlatch(basey,masterscale), n.tags_as_hash] }
# find the relations used by those nodes and ways
relation_ids = (Relation.find_for_nodes_and_ways(nodes_in_area.collect {|n| n.id}, way_ids)||[]).collect {|n| n.id}.uniq
relation_ids = (Relation.find_for_nodes_and_ways(nodes_in_area.collect {|n| n.id}, way_ids)).collect {|n| n.id}.uniq
[way_ids,points,relation_ids]
end

View file

@ -102,10 +102,12 @@ class Relation < ActiveRecord::Base
return el1
end
def self.find_for_nodes_and_ways(node_ids, way_ids)
# collect relationships. currently done in one big block at the end;
# may need to move this upwards if people want automatic completion of
# relationships, i.e. deliver referenced objects like we do with ways...
# FIXME: rip out the fucking SQL
def self.find_for_nodes_and_ways(node_ids, way_ids)
return [] if node_ids.empty? and node_ids.empty?
relations = Array.new
if node_ids.length > 0