Commit a85e89d9 authored by Michael Rose's avatar Michael Rose

story: update: progress + checking correct field

parent 35e16638
......@@ -15,9 +15,10 @@
class StoryUpdate < ActiveRecord::Base
def self.fix_json
StoryUpdate.all.find_in_batches(start: 2300000, batch_size: 20) do |updates|
id = 2300000
StoryUpdate.all.find_in_batches(start: id, batch_size: 1000) do |updates|
updates.each do |update|
if update.is_a?(String) and update.update_contents.starts_with?('"')
if update.update_contents.is_a?(String) and update.update_contents.starts_with?('"')
begin
update.update_contents = JSON.parse(update.update_contents)
update.save!
......@@ -26,6 +27,8 @@ class StoryUpdate < ActiveRecord::Base
end
end
end
id += 1000
puts "Finished batch (#{id}/2748371)"
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment