mirror of
https://github.com/discourse/discourse.git
synced 2025-03-27 10:05:46 +08:00
optimize categories:create_definition task
This commit is contained in:
parent
78e14abb32
commit
df55e5bac4
@ -26,19 +26,9 @@ task "categories:create_definition" => :environment do
|
|||||||
puts "Creating category definitions"
|
puts "Creating category definitions"
|
||||||
puts
|
puts
|
||||||
|
|
||||||
done = 0
|
Category.where(topic_id: nil).each(&:create_category_definition)
|
||||||
current = 0
|
|
||||||
total = Category.count
|
|
||||||
|
|
||||||
Category.find_each do |c|
|
puts "", "Done!", ""
|
||||||
if c.topic_id.blank?
|
|
||||||
c.create_category_definition
|
|
||||||
done += 1
|
|
||||||
end
|
|
||||||
print_status(current += 1, total)
|
|
||||||
end
|
|
||||||
|
|
||||||
puts "", "category definition created for #{done} categories!", ""
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user