mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
FIX: always show the progress bars when skipping posts/users in importers
This commit is contained in:
@ -228,11 +228,10 @@ class ImportScripts::Base
|
|||||||
results.each do |result|
|
results.each do |result|
|
||||||
u = yield(result)
|
u = yield(result)
|
||||||
|
|
||||||
|
# block returns nil to skip a post
|
||||||
if u.nil?
|
if u.nil?
|
||||||
users_skipped += 1
|
users_skipped += 1
|
||||||
next # block returns nil to skip a post
|
else
|
||||||
end
|
|
||||||
|
|
||||||
import_id = u[:id]
|
import_id = u[:id]
|
||||||
|
|
||||||
if user_id_from_imported_user_id(import_id)
|
if user_id_from_imported_user_id(import_id)
|
||||||
@ -251,6 +250,7 @@ class ImportScripts::Base
|
|||||||
@failed_users << u
|
@failed_users << u
|
||||||
puts "Skipping user id #{import_id} because email is blank"
|
puts "Skipping user id #{import_id} because email is blank"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
print_status users_created + users_skipped + @failed_users.length + (opts[:offset] || 0), total
|
print_status users_created + users_skipped + @failed_users.length + (opts[:offset] || 0), total
|
||||||
end
|
end
|
||||||
@ -370,11 +370,10 @@ class ImportScripts::Base
|
|||||||
results.each do |r|
|
results.each do |r|
|
||||||
params = yield(r)
|
params = yield(r)
|
||||||
|
|
||||||
|
# block returns nil to skip a post
|
||||||
if params.nil?
|
if params.nil?
|
||||||
skipped += 1
|
skipped += 1
|
||||||
next # block returns nil to skip a post
|
else
|
||||||
end
|
|
||||||
|
|
||||||
import_id = params.delete(:id).to_s
|
import_id = params.delete(:id).to_s
|
||||||
|
|
||||||
if post_id_from_imported_post_id(import_id)
|
if post_id_from_imported_post_id(import_id)
|
||||||
@ -406,6 +405,7 @@ class ImportScripts::Base
|
|||||||
puts e.backtrace.join("\n")
|
puts e.backtrace.join("\n")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
print_status skipped + created + (opts[:offset] || 0), total
|
print_status skipped + created + (opts[:offset] || 0), total
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user