From cb266362cd8f4d16e726455bb421962c71eec5fc Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Mon, 14 Jul 2008 20:14:53 +0000 Subject: [PATCH] ActionItem501: better progress indication --- db/migrate/044_create_product_categorizations.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/db/migrate/044_create_product_categorizations.rb b/db/migrate/044_create_product_categorizations.rb index 5fd310d..827d4c1 100644 --- a/db/migrate/044_create_product_categorizations.rb +++ b/db/migrate/044_create_product_categorizations.rb @@ -9,16 +9,14 @@ class CreateProductCategorizations < ActiveRecord::Migration t.timestamps end - Product.find(:all).each do |p| + total = Product.count.to_f + percent = 0 + Product.find(:all).each_with_index do |p,i| if p.product_category ProductCategorization.add_category_to_product(p.product_category, p) - print ".\0" - else - print "x\0" end - $stdout.flush + puts "%02.02f" % ((100.0 * i.to_f)/total) end - print "\n" end -- libgit2 0.21.2