--- a/maxious-canberra-transit-feed/03-locatetimepoints.rb +++ b/maxious-canberra-transit-feed/03-locatetimepoints.rb @@ -51,7 +51,7 @@ if ask_if("Insert Timing Point names to database?") $time_points.each do |time_point| begin - time_point = time_point.gsub(/\\/, '\&\&').gsub(/'/, "''") + time_point = time_point.gsub(/\\/, '\&\&').gsub(/'/, "''").gsub("St", "%") res = connbus.exec("INSERT INTO timing_point (name) VALUES ('#{time_point}')") puts "Put '#{time_point}' into DB" rescue PGError => e @@ -140,11 +140,10 @@ nodeID = ask("Enter selected node ID:", :integer) if results['features'].at(nodeID) != nil node = results['features'][nodeID] - guess = ask_if("Is this a guess?") puts "Location #{node['centroid']['coordinates'][0]},#{node['centroid']['coordinates'][1]} for #{null_point_name}" begin res = connbus.exec("UPDATE timing_point SET lat = #{node['centroid']['coordinates'][0]*10000000}, lng = - #{node['centroid']['coordinates'][1]*10000000},guess = #{guess} WHERE name = '#{name}'") + #{node['centroid']['coordinates'][1]*10000000},guess = true WHERE name = '#{name}'") puts "Put '#{null_point_name}' into DB" rescue PGError => e puts "Error inserting '#{null_point_name}' to DB #{e}"