mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
working on loading data
This commit is contained in:
parent
a8594e848d
commit
b58bca6012
2 changed files with 8 additions and 7 deletions
|
|
@ -77,6 +77,7 @@ class Attempt < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_counts
|
def update_counts
|
||||||
|
return if ENV['BULK_PROCESS']
|
||||||
recipient.update_attributes(
|
recipient.update_attributes(
|
||||||
attempts_count: recipient.attempts.count,
|
attempts_count: recipient.attempts.count,
|
||||||
responses_count: recipient.attempts.with_answer.count
|
responses_count: recipient.attempts.with_answer.count
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ namespace :data do
|
||||||
bad_answers = {}
|
bad_answers = {}
|
||||||
year = '2017'
|
year = '2017'
|
||||||
|
|
||||||
timeToRun = 10000 * 60 * 60
|
timeToRun = 6 * 60 * 60
|
||||||
startIndex = 0
|
startIndex = 0
|
||||||
startTime = Time.new
|
startTime = Time.new
|
||||||
|
|
||||||
|
|
@ -158,12 +158,12 @@ namespace :data do
|
||||||
|
|
||||||
t = Time.new
|
t = Time.new
|
||||||
csv.each_with_index do |row, index|
|
csv.each_with_index do |row, index|
|
||||||
# next if index < startIndex
|
next if index < startIndex
|
||||||
#
|
|
||||||
# if Time.new - startTime >= timeToRun
|
if Time.new - startTime >= timeToRun
|
||||||
# puts("ENDING #{timeToRun} SECONDS: #{Time.new - startTime} = #{startIndex} -> #{index} = #{index - startIndex} or #{(Time.new - t) / (index - startIndex)} per second")
|
puts("ENDING #{timeToRun} SECONDS: #{Time.new - startTime} = #{startIndex} -> #{index} = #{index - startIndex} or #{(Time.new - t) / (index - startIndex)} per second")
|
||||||
# break
|
break
|
||||||
# end
|
end
|
||||||
|
|
||||||
if index % 10 == 0
|
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")
|
puts("DATAMSG: PROCESSING ROW: #{index} OUT OF #{csv.length} ROWS: #{Time.new - t} - Total: #{Time.new - startTime} - #{timeToRun - (Time.new - startTime)} TO GO")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue