]> git.openstreetmap.org Git - rails.git/commitdiff
fixed null value bug in rake task
authorNick Black <nickb@svn.openstreetmap.org>
Fri, 25 Jan 2008 14:26:39 +0000 (14:26 +0000)
committerNick Black <nickb@svn.openstreetmap.org>
Fri, 25 Jan 2008 14:26:39 +0000 (14:26 +0000)
lib/tasks/add_version_to_nodes.rake
lib/tasks/populate_node_tags.rake

index 1ec831234ca83b14ac57c624ecf62bda13e3a17e..990ce5c4c164541e6190c78e2aad66180bd42582 100644 (file)
@@ -1,5 +1,5 @@
 namespace 'db' do
-  desc 'Populate the node_tags table'
+  desc 'Adds a version number to the noes table'
   task :node_version  do
     require File.dirname(__FILE__) + '/../../config/environment'
 
@@ -28,7 +28,7 @@ namespace 'db' do
           temp_old_node.visible = node.visible
           temp_old_node.timestamp = node.timestamp
           temp_old_node.tile = node.tile
-          temp_old_node.version = node.version
+          temp_old_node.version = n
           temp_old_node.save! || raise
           n +=1 
         end
index 6a57dffc553242495b46f69c593e65787d49cd2f..86747cfe4bf319fead0770ccd8a9ed76a25340a4 100644 (file)
@@ -13,8 +13,8 @@ namespace 'db' do
         node.tags.split(';').each do |tag|
           nt = NodeTag.new
           nt.id = node.id
-          nt.k = tag.split('=')[0]
-          nt.v = tag.split('=')[1]
+          nt.k = tag.split('=')[0] || ''
+          nt.v = tag.split('=')[1] || ''
           nt.sequence_id = seq_id 
           nt.save! || raise
           seq_id += 1
@@ -26,8 +26,8 @@ namespace 'db' do
         old_node.tags.split(';').each do |tag|
           ont = OldNodeTag.new
           ont.id = node.id #the id of the node tag
-          ont.k = tag.split('=')[0]
-          ont.v = tag.split('=')[1]
+          ont.k = tag.split('=')[0] || ''
+          ont.v = tag.split('=')[1] || ''
           ont.version = version
           ont.sequence_id = sequence_id
           ont.save! || raise