FEATURE: Skip batches if all records exist

Update all import scripts to take advantage of all_records_exist?
This commit is contained in:
Kane York
2015-09-21 16:48:42 -07:00
parent 200ee15991
commit 821124f3fd
20 changed files with 99 additions and 3 deletions

View File

@@ -71,6 +71,8 @@ class ImportScripts::VBulletin < ImportScripts::Base
break if users.size < 1
next if all_records_exist? :users, users.map {|u| u["userid"].to_i}
create_users(users, total: user_count, offset: offset) do |user|
username = @htmlentities.decode(user["username"]).strip
@@ -208,6 +210,7 @@ class ImportScripts::VBulletin < ImportScripts::Base
SQL
break if topics.size < 1
next if all_records_exist? :posts, topics.map {|t| "thread-#{topic["threadid"]}" }
create_posts(topics, total: topic_count, offset: offset) do |topic|
raw = preprocess_post_raw(topic["raw"]) rescue nil
@@ -249,6 +252,7 @@ class ImportScripts::VBulletin < ImportScripts::Base
SQL
break if posts.size < 1
next if all_records_exist? :posts, posts.map {|p| p["postid"] }
create_posts(posts, total: post_count, offset: offset) do |post|
raw = preprocess_post_raw(post["raw"]) rescue nil