when 'getway_old'; results[index]=AMF.putdata(index,getway_old(args))
when 'getway_history'; results[index]=AMF.putdata(index,getway_history(args))
when 'putway'; r=putway(args,renumberednodes)
- renumberednodes=r[3]
- results[index]=AMF.putdata(index,r)
+ renumberednodes=r[3]
+ results[index]=AMF.putdata(index,r)
when 'deleteway'; results[index]=AMF.putdata(index,deleteway(args))
when 'putpoi'; results[index]=AMF.putdata(index,putpoi(args))
when 'getpoi'; results[index]=AMF.putdata(index,getpoi(args))
RAILS_DEFAULT_LOGGER.info(" Message: getway, id=#{wayid}")
- way = Way.find(wayid, :include => :nodes)
+ # Ideally we would do ":include => :nodes" here but if we do that
+ # then rails only seems to return the first copy of a node when a
+ # way includes a node more than once
+ way = Way.find(wayid)
+
long_array = []
lat_array = []
points = []
RAILS_DEFAULT_LOGGER.info(" Message: putway, id=#{originalway}")
- # -- Temporary check for null IDs
+ # -- Check for null IDs or short ways
points.each do |a|
if a[2]==0 or a[2].nil? then return -2,"Server error - node with id 0 found in way #{originalway}." end
end
+
+ if points.length<2 then return -2,"Server error - way is only #{points.length} points long." end
# -- 3. read original way into memory
# Get the latest version id of a way
def getlastversion(id,version) #:doc:
- old_way = OldWay.find(:first, :conditions => ['id = ?' , id], :order => 'version DESC')
+ old_way = OldWay.find(:first, :conditions => ['visible=1 AND id=?' , id], :order => 'version DESC')
old_way.version
end