diff options
author | Mark Longair <mhl@pobox.com> | 2013-10-29 17:49:16 +0000 |
---|---|---|
committer | Mark Longair <mhl@pobox.com> | 2013-10-29 17:49:16 +0000 |
commit | d41314abf22b55c3215d6d012e573ea76391eeb3 (patch) | |
tree | 81a4bcfa789b37b3e649af0468bd37a9f4ff81b8 /lib/tasks/import.rake | |
parent | 37c91fceb8a2624e8bfb7a5dd644a36c81938b97 (diff) |
Remove the confusing "time remaining" message
The time estimates were confusing on two counts:
- The messages mixed locales
- The estimates were hugely inaccurate, since the import slows
down as time goes on
Diffstat (limited to 'lib/tasks/import.rake')
-rw-r--r-- | lib/tasks/import.rake | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake index 015331a3a..0e8397fde 100644 --- a/lib/tasks/import.rake +++ b/lib/tasks/import.rake @@ -1,13 +1,8 @@ require 'csv' require 'tempfile' -require 'action_view' -require 'action_view/helpers' - namespace :import do - include ActionView::Helpers::DateHelper - desc 'Import public bodies from CSV provided on standard input' task :import_csv => :environment do dryrun = ENV['DRYRUN'] != '0' @@ -58,8 +53,6 @@ namespace :import do STDERR.puts "Now importing the public bodies..." - start = Time.now.to_f - # Now it's (probably) safe to try to import: errors, notes = PublicBody.import_csv(tmp_csv.path, tag='', @@ -67,13 +60,9 @@ namespace :import do dryrun, editor="#{ENV['USER']} (Unix user)", I18n.available_locales) do |row_number, fields| - now = Time.now.to_f percent_complete = (100 * row_number.to_f / number_of_rows).to_i - expected_end = number_of_rows * (now - start) / row_number.to_f + start - time_left = distance_of_time_in_words now, expected_end STDERR.print "#{row_number} out of #{number_of_rows} " - STDERR.print "(#{percent_complete}% complete) " - STDERR.puts "#{time_left} remaining" + STDERR.puts "(#{percent_complete}% complete)" end if errors.length > 0 |