mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
working on 2019 data import
This commit is contained in:
parent
3545cd419f
commit
619e7f3ac1
3 changed files with 8 additions and 5038 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -12,6 +12,7 @@
|
||||||
# RENAME SCHOOLS = s = SCHOOLS; s.each { |correct, incorrect| District.find_by_name("Boston").schools.find_by_name(incorrect[0]).update(name: correct) }
|
# RENAME SCHOOLS = s = SCHOOLS; s.each { |correct, incorrect| District.find_by_name("Boston").schools.find_by_name(incorrect[0]).update(name: correct) }
|
||||||
# s.map { |correct, incorrect| District.find_by_name("Boston").schools.find_by_name(incorrect.to_s).merge_into(correct) }
|
# s.map { |correct, incorrect| District.find_by_name("Boston").schools.find_by_name(incorrect.to_s).merge_into(correct) }
|
||||||
# sudo heroku run rake data:load_questions_csv -a mciea-beta
|
# sudo heroku run rake data:load_questions_csv -a mciea-beta
|
||||||
|
# sudo heroku run rake data:sync_questions -a mciea-beta
|
||||||
# sudo heroku run:detached rake data:load_responses -a mciea-beta --size performance-l
|
# sudo heroku run:detached rake data:load_responses -a mciea-beta --size performance-l
|
||||||
# sudo heroku run rake data:move_likert_to_submeasures -a mciea-beta
|
# sudo heroku run rake data:move_likert_to_submeasures -a mciea-beta
|
||||||
# sudo heroku run:detached rake data:sync -a mciea-beta --size performance-l
|
# sudo heroku run:detached rake data:sync -a mciea-beta --size performance-l
|
||||||
|
|
@ -298,7 +299,7 @@ namespace :data do
|
||||||
stopIndex = 100000
|
stopIndex = 100000
|
||||||
startTime = Time.new
|
startTime = Time.new
|
||||||
|
|
||||||
# ['student_responses'].each do |file|
|
# ['teacher_responses'].each do |file|
|
||||||
['student_responses', 'teacher_responses'].each do |file|
|
['student_responses', 'teacher_responses'].each do |file|
|
||||||
recipients = file.split('_')[0]
|
recipients = file.split('_')[0]
|
||||||
target_group = Question.target_groups["for_#{recipients}s"]
|
target_group = Question.target_groups["for_#{recipients}s"]
|
||||||
|
|
@ -320,14 +321,15 @@ namespace :data do
|
||||||
t = Time.new
|
t = Time.new
|
||||||
end
|
end
|
||||||
|
|
||||||
district_name = row['District']
|
district_name = row['Q111']
|
||||||
if district_name.blank? || district_name == "NA"
|
if district_name.blank? || district_name == "NA"
|
||||||
|
puts "DISTRICT NOT FOUND: #{district_name}"
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
# district_name = row['To begin, please select your district.'] if district_name.nil?
|
# district_name = row['To begin, please select your district.'] if district_name.nil?
|
||||||
district = District.find_or_create_by(name: district_name, state_id: 1)
|
district = District.find_or_create_by(name: district_name, state_id: 1)
|
||||||
|
|
||||||
school_name = row["School.#{district_name}"]
|
school_name = row["SchoolName"]
|
||||||
|
|
||||||
if school_name.blank? || school_name == "NA"
|
if school_name.blank? || school_name == "NA"
|
||||||
puts "BLANK SCHOOL NAME: #{district.name} - #{index}"
|
puts "BLANK SCHOOL NAME: #{district.name} - #{index}"
|
||||||
|
|
@ -343,7 +345,7 @@ namespace :data do
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
respondent_id = "#{recipients}-#{index}-#{row["X_recordId"]}"
|
respondent_id = "#{recipients}-#{index}-#{row["ResponseID"]}"
|
||||||
recipient_id = respondent_map["#{school.id}-#{@year}-#{respondent_id}"]
|
recipient_id = respondent_map["#{school.id}-#{@year}-#{respondent_id}"]
|
||||||
if recipient_id.present?
|
if recipient_id.present?
|
||||||
recipient = school.recipients.where(id: recipient_id).first
|
recipient = school.recipients.where(id: recipient_id).first
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue