working on loading data

pull/1/head
Jared Cosulich 8 years ago
parent a8594e848d
commit b58bca6012

@ -77,6 +77,7 @@ class Attempt < ApplicationRecord
end
def update_counts
return if ENV['BULK_PROCESS']
recipient.update_attributes(
attempts_count: recipient.attempts.count,
responses_count: recipient.attempts.with_answer.count

@ -145,7 +145,7 @@ namespace :data do
bad_answers = {}
year = '2017'
timeToRun = 10000 * 60 * 60
timeToRun = 6 * 60 * 60
startIndex = 0
startTime = Time.new
@ -158,12 +158,12 @@ namespace :data do
t = Time.new
csv.each_with_index do |row, index|
# next if index < startIndex
#
# if Time.new - startTime >= timeToRun
# puts("ENDING #{timeToRun} SECONDS: #{Time.new - startTime} = #{startIndex} -> #{index} = #{index - startIndex} or #{(Time.new - t) / (index - startIndex)} per second")
# break
# end
next if index < startIndex
if Time.new - startTime >= timeToRun
puts("ENDING #{timeToRun} SECONDS: #{Time.new - startTime} = #{startIndex} -> #{index} = #{index - startIndex} or #{(Time.new - t) / (index - startIndex)} per second")
break
end
if index % 10 == 0
puts("DATAMSG: PROCESSING ROW: #{index} OUT OF #{csv.length} ROWS: #{Time.new - t} - Total: #{Time.new - startTime} - #{timeToRun - (Time.new - startTime)} TO GO")

Loading…
Cancel
Save