Commit cb266362cd8f4d16e726455bb421962c71eec5fc
1 parent
78ff310c
Exists in
master
and in
29 other branches
ActionItem501: better progress indication
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2269 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
1 changed file
with
4 additions
and
6 deletions
Show diff stats
db/migrate/044_create_product_categorizations.rb
... | ... | @@ -9,16 +9,14 @@ class CreateProductCategorizations < ActiveRecord::Migration |
9 | 9 | t.timestamps |
10 | 10 | end |
11 | 11 | |
12 | - Product.find(:all).each do |p| | |
12 | + total = Product.count.to_f | |
13 | + percent = 0 | |
14 | + Product.find(:all).each_with_index do |p,i| | |
13 | 15 | if p.product_category |
14 | 16 | ProductCategorization.add_category_to_product(p.product_category, p) |
15 | - print ".\0" | |
16 | - else | |
17 | - print "x\0" | |
18 | 17 | end |
19 | - $stdout.flush | |
18 | + puts "%02.02f" % ((100.0 * i.to_f)/total) | |
20 | 19 | end |
21 | - print "\n" | |
22 | 20 | |
23 | 21 | end |
24 | 22 | ... | ... |