FEATURE: Skip batches if all records exist
Update all import scripts to take advantage of all_records_exist?
This commit is contained in:
@@ -56,6 +56,8 @@ module ImportScripts::PhpBB3
|
||||
rows = @database.fetch_users(offset)
|
||||
break if rows.size < 1
|
||||
|
||||
next if all_records_exist? :users, importer.map_to_import_ids(rows)
|
||||
|
||||
create_users(rows, total: total_count, offset: offset) do |row|
|
||||
importer.map_user(row)
|
||||
end
|
||||
|
||||
@@ -9,6 +9,10 @@ module ImportScripts::PhpBB3
|
||||
@settings = settings
|
||||
end
|
||||
|
||||
def map_to_import_ids(array)
|
||||
array.map {|u| u[:user_id]}
|
||||
end
|
||||
|
||||
def map_user(row)
|
||||
is_active_user = row[:user_inactive_reason] != Constants::INACTIVE_REGISTER
|
||||
|
||||
|
||||
Reference in New Issue
Block a user