mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Change survey data loader spec to use factorybot objects instead of loading seeds. Change databasecleaner to use transaction. Add back babel-preset dependency to fix failing javascript test in production.
This commit is contained in:
parent
caeda61ae1
commit
282a671531
11 changed files with 1091 additions and 149 deletions
|
|
@ -23,12 +23,19 @@ class AcademicYear < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
# This may cause problems if academic years get loaded from csv instead of the current method that requires a code change to the seeder script. This is because a change in code will trigger a complete reload of the application whereas loading from csv does not. This means if we change academic year to load from csv, the set of academic years will be stale when new years are added.
|
||||
def self.academic_years
|
||||
@@academic_years ||= AcademicYear.all.map { |academic_year| [academic_year.range, academic_year] }.to_h
|
||||
end
|
||||
|
||||
# Needed to reset the academic years when testing with specs that create the same academic year in a before :each block
|
||||
def self.reset_academic_years
|
||||
@@academic_years = nil
|
||||
end
|
||||
|
||||
private_class_method :academic_years
|
||||
private_class_method :parse_year_range
|
||||
end
|
||||
|
||||
AcademicYearRange = Struct.new(:start, :end)
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class SurveyItemValues
|
|||
end
|
||||
|
||||
def schools
|
||||
@@schools ||= School.all.map { |school| [school.dese_id, school] }.to_h
|
||||
School.all.map { |school| [school.dese_id, school] }.to_h
|
||||
end
|
||||
|
||||
def grade
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ class SurveyResponsesDataLoader
|
|||
process_row(row: SurveyItemValues.new(row:, headers:, genders: genders_hash, survey_items: all_survey_items),
|
||||
rules:)
|
||||
end
|
||||
|
||||
SurveyItemResponse.import survey_item_responses.compact.flatten, batch_size: 500
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,6 +6,10 @@
|
|||
},
|
||||
"private": "true",
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.0.0-0",
|
||||
"@babel/helper-compilation-targets": "7.20.7",
|
||||
"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "7.20.7",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@fortawesome/fontawesome-free": "^6.0.0-beta3",
|
||||
"@hotwired/stimulus": "^3.0.1",
|
||||
"@hotwired/turbo-rails": "^7.1.1",
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
Start Date,End Date,Response Type,IP Address,Progress,Duration (in seconds),Finished,RecordedDate,ResponseId,LASID,Recipient Last Name,Recipient First Name,Recipient Email,External Data Reference,Location Latitude,Location Longitude,Distribution Channel,User Language,district,school,DESE ID,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,s-emsa-q1,s-emsa-q2,s-emsa-q3,s-tint-q1,s-tint-q2,#N/A,s-tint-q4,s-tint-q5,s-acpr-q1,s-acpr-q2,s-acpr-q3,s-acpr-q4,#N/A,#N/A,s-cure-q3,s-cure-q4,#N/A,s-sten-q2,s-sten-q3,s-sper-q1,s-sper-q2,s-sper-q3,s-sper-q4,s-civp-q1,s-civp-q2,s-civp-q3,s-civp-q4,s-grmi-q1,#N/A,#N/A,s-grmi-q4,s-appa-q1,s-appa-q2,#N/A,s-peff-q1,s-peff-q2,s-peff-q3,s-peff-q4,s-peff-q5,s-peff-q6,s-sbel-q1,s-sbel-q2,s-sbel-q3,s-sbel-q4,s-sbel-q5,s-phys-q1,s-phys-q1-1,s-phys-q2,s-phys-q3,s-phys-q4,s-vale-q1,#N/A,#N/A,s-vale-q4,#N/A,s-acst-q2,s-acst-q3,#N/A,#N/A,s-grit-q1,s-grit-q2,s-grit-q3,s-grit-q4,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,race,What is your race/ethnicity?(Please select all that apply) - Selected Choice,grade,gender
|
||||
2020-09-29 18:28:41,2020-09-29 18:48:28,0,73.249.89.226,6,1186,0,2020-09-30T18:48:50,student_survey_response_1,123456,,,,,,,anonymous,EN,1,8,160505,,,,dddd,4,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,0,some non-integer response,6,,,,5,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,EN,,,,,1,888,11th,1
|
||||
Start Date,End Date,Response Type,IP Address,Progress,Duration (in seconds),Finished,RecordedDate,ResponseId,LASID,Recipient Last Name,Recipient First Name,Recipient Email,External Data Reference,Location Latitude,Location Longitude,Distribution Channel,User Language,district,school,DESE ID,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,s-emsa-q1,s-emsa-q2,s-emsa-q3,s-tint-q1,s-tint-q2,#N/A,s-tint-q4,s-tint-q5,s-acpr-q1,s-acpr-q2,s-acpr-q3,s-acpr-q4,#N/A,#N/A,s-cure-q3,s-cure-q4,#N/A,s-sten-q2,s-sten-q3,s-sper-q1,s-sper-q2,s-sper-q3,s-sper-q4,s-civp-q1,s-civp-q2,s-civp-q3,s-civp-q4,s-grmi-q1,#N/A,#N/A,s-grmi-q4,s-appa-q1,s-appa-q2,#N/A,s-peff-q1,s-peff-q2,s-peff-q3,s-peff-q4,s-peff-q5,s-peff-q6,s-sbel-q1,s-sbel-q2,s-sbel-q3,s-sbel-q4,s-sbel-q5,s-phys-q1,s-phys-q1-1,s-phys-q2,s-phys-q3,s-phys-q4,s-vale-q1,s-vale-q2,s-vale-q3,s-vale-q4,s-acst-q1,s-acst-q2,s-acst-q3,s-acst-q4,s-acst-q5,s-grit-q1,s-grit-q2,s-grit-q3,s-grit-q4,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,race,What is your race/ethnicity?(Please select all that apply) - Selected Choice,grade,gender
|
||||
2020-09-29 18:28:41,2020-09-29 18:48:28,0,73.249.89.226,6,1186,0,2020-09-30T18:48:50,student_survey_response_1,123456,,,,,,,anonymous,EN,1,8,1500025,,,,dddd,4,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,0,some non-integer response,6,,,,5,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,EN,,,,,1,888,11th,1
|
||||
2021-02-23 15:12:58,2021-02-23 15:13:17,0,50.207.254.114,0,19,0,2021-02-24T15:13:19,student_survey_response_2,234567,,,,,,,anonymous,EN,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,NA,,,,,,,,,,,,,,,,,,,,,EN,,,,,"2,3,4",888,10,
|
||||
2021-03-31 9:50:19,2021-03-31 9:59:01,0,108.7.17.250,100,522,1,2021-03-31T09:59:02,student_survey_response_3,345678,,,,,42.53340149,-70.96530151,anonymous,EN,3,2,1600310,12,4,108,3300,7,1,,,,,,,,,,,,,,2,4,2,1,4,3,3,,,,,3,3,3,3,,,,,NA,,,,,,,,,3,2,3,3,2,1,3,3,4,1,3,3,4,4,2,4,3,3,4,3,3,3,4,3,3,3,3,3,,,,,,,,,,3,4,4,2,3,3,1,,3,,EN,Math teacher,,,,6,888,8,2
|
||||
2021-03-31 9:50:09,2021-03-31 10:00:16,0,67.186.188.168,100,607,1,2021-03-31T10:00:17,student_survey_response_4,456789,,,,,42.63510132,-71.30139923,anonymous,EN,3,2,1600310,12,18,108,2064,7,1,,2,2,1,,,,,,,,,,,,,,,,,,,,,,,,,3,5,3,3,,,,,,,,,,4,4,3,4,5,1,,1,5,1,3,2,4,4,1,2,1,3,2,3,3,3,4,2,5,3,4,5,5,3,3,4,3,,,,,4,4,4,4,3,5,2,,2,,EN,,,,English teacher,7,888,8,3
|
||||
2021-03-31 9:51:39,2021-03-31 10:01:36,0,73.47.153.77,100,596,1,2021-03-31T10:01:36,student_survey_response_5,567890,,,,,42.65820313,-71.30580139,anonymous,EN,3,2,1600310,6,15,109,3710,7,1,,2,2,2,,,,,,,,,,3,3,4,3,3,3,3,4,3,4,3,4,4,5,4,3,4,3,5,2,2,3,,,,,,,,,,,,1,,2,5,1,3,3,2,4,3,5,4,,,,,,,,,,,,5,4,3,4,4,4,4,4,4,,,,,,,2,,2,,EN,,,Social Studies teacher,,"1,2,3,4,5,8,6,7",888,7,4
|
||||
2021-03-31 9:51:39,2021-03-31 10:01:36,0,73.47.153.77,100,596,1,2021-03-31T10:01:36,student_survey_response_6,,,,,,42.65820313,-71.30580139,anonymous,EN,3,2,1600310,6,15,109,3710,7,1,,2,2,2,,,,,,,,,,3,3,4,3,3,3,3,4,3,4,3,4,4,5,4,3,4,3,5,2,2,3,,,,,,,,,,,,1,,2,5,1,3,3,2,4,3,5,4,,,,,,,,,,,,5,4,3,4,4,4,4,4,4,,,,,,,2,,2,,EN,,,Social Studies teacher,,"1,2,3,4,5,8",888,3,NA
|
||||
2021-03-31 9:51:39,2021-03-31 10:01:36,0,73.47.153.77,100,596,1,2021-03-31T10:01:36,student_survey_response_7,,,,,,42.65820313,-71.30580139,anonymous,EN,3,2,1600310,6,15,109,3710,7,1,,2,2,2,,,,,,,,,,3,3,4,3,3,3,3,4,3,4,3,4,4,5,4,3,4,3,5,2,2,3,,,,,,,,,,,,1,,2,5,1,3,3,2,4,3,5,4,,,,,,,,,,,,5,4,3,4,4,4,4,4,4,,,,,,,2,,2,,EN,,,Social Studies teacher,,,,4,
|
||||
2021-03-31 9:50:19,2021-03-31 9:59:01,0,108.7.17.250,100,522,1,2021-03-31T09:59:02,student_survey_response_3,345678,,,,,42.53340149,-70.96530151,anonymous,EN,3,2,1500505,12,4,108,3300,7,1,,,,,,,,,,,,,,2,4,2,1,4,3,3,,,,,3,3,3,3,,,,,NA,,,,,,,,,3,2,3,3,2,1,3,3,4,1,3,3,4,4,2,4,3,3,4,3,3,3,4,3,3,3,3,3,,,,,,,,,,3,4,4,2,3,3,1,,3,,EN,Math teacher,,,,6,888,8,2
|
||||
2021-03-31 9:50:09,2021-03-31 10:00:16,0,67.186.188.168,100,607,1,2021-03-31T10:00:17,student_survey_response_4,456789,,,,,42.63510132,-71.30139923,anonymous,EN,3,2,1500505,12,18,108,2064,7,1,,2,2,1,,,,,,,,,,,,,,,,,,,,,,,,,3,5,3,3,,,,,,,,,,4,4,3,4,5,1,,1,5,1,3,2,4,4,1,2,1,3,2,3,3,3,4,2,5,3,4,5,5,3,3,4,3,,,,,4,4,4,4,3,5,2,,2,,EN,,,,English teacher,7,888,8,3
|
||||
2021-03-31 9:51:39,2021-03-31 10:01:36,0,73.47.153.77,100,596,1,2021-03-31T10:01:36,student_survey_response_5,567890,,,,,42.65820313,-71.30580139,anonymous,EN,3,2,1500505,6,15,109,3710,7,1,,2,2,2,,,,,,,,,,3,3,4,3,3,3,3,4,3,4,3,4,4,5,4,3,4,3,5,2,2,3,,,,,,,,,,,,1,,2,5,1,3,3,2,4,3,5,4,,,,,,,,,,,,5,4,3,4,4,4,4,4,4,,,,,,,2,,2,,EN,,,Social Studies teacher,,"1,2,3,4,5,8,6,7",888,7,4
|
||||
2021-03-31 9:51:39,2021-03-31 10:01:36,0,73.47.153.77,100,596,1,2021-03-31T10:01:36,student_survey_response_6,,,,,,42.65820313,-71.30580139,anonymous,EN,3,2,1500505,6,15,109,3710,7,1,,2,2,2,,,,,,,,,,3,3,4,3,3,3,3,4,3,4,3,4,4,5,4,3,4,3,5,2,2,3,,,,,,,,,,,,1,,2,5,1,3,3,2,4,3,5,4,,,,,,,,,,,,5,4,3,4,4,4,4,4,4,,,,,,,2,,2,,EN,,,Social Studies teacher,,"1,2,3,4,5,8",888,3,NA
|
||||
2021-03-31 9:51:39,2021-03-31 10:01:36,0,73.47.153.77,100,596,1,2021-03-31T10:01:36,student_survey_response_7,,,,,,42.65820313,-71.30580139,anonymous,EN,3,2,1500505,6,15,109,3710,7,1,,2,2,2,,,,,,,,,,3,3,4,3,3,3,3,4,3,4,3,4,4,5,4,3,4,3,5,2,2,3,,,,,,,,,,,,1,,2,5,1,3,3,2,4,3,5,4,,,,,,,,,,,,5,4,3,4,4,4,4,4,4,,,,,,,2,,2,,EN,,,Social Studies teacher,,,,4,
|
||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"1,2,3,4,5,8",,,
|
||||
|
|
|
|||
|
|
|
@ -1,6 +1,6 @@
|
|||
Start Date,End Date,Response Type,IP Address,Progress,Duration (in seconds),Finished,RecordedDate,ResponseId,Recipient Last Name,Recipient First Name,Recipient Email,External Data Reference,Location Latitude,Location Longitude,Distribution Channel,User Language,District,school,,DESE ID,t-prep-q1,t-prep-q2,t-prep-q3,t-pcom-q1,t-pcom-q2,t-pcom-q3,t-pcom-q4,t-pcom-q5,t-ieff-q1,t-ieff-q2,t-ieff-q3,t-ieff-q4,t-qupd-q3,t-qupd-q2,t-qupd-q1,t-qupd-q4,t-coll-q1,t-coll-q2,t-coll-q3,t-prtr-q1,t-prtr-q2,t-prtr-q3,t-inle-q1,t-inle-q2,t-inle-q3,t-pvic-q1,t-pvic-q2,t-pvic-q3,t-psup-q1,t-psup-q2,t-psup-q3,t-psup-q4,t-acch-q1,t-acch-q2,t-acch-q3,t-reso-q1,t-reso-q2,t-reso-q3,t-reso-q4,t-reso-q5,t-sust-q1,t-sust-q2,t-sust-q3,t-sust-q4,t-curv-q1,t-curv-q2,t-curv-q3,t-curv-q4,t-cure-q1,t-cure-q2,t-cure-q3,t-cure-q4,t-peng-q1,t-peng-q2,t-peng-q3,t-peng-q4,t-ceng-q1,t-ceng-q2,t-ceng-q3,t-ceng-q4,#N/A,t-sach-q2,t-sach-q3,t-psol-q1,t-psol-q2,t-psol-q3,t-expa-q2,t-expa-q3,t-phya-q2,t-phya-q3,,,,
|
||||
2020-10-09 9:42:45,2020-10-09 11:08:57,0,50.204.125.194,93,5172,0,2020-10-16 11:09:03,teacher_survey_response_1,,,,,,,anonymous,EN,1,1,4,160505,,,,,,3,,,,,,,,,,,3,3,3,NA,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,,,,,,,,,,,,
|
||||
2020-10-09 9:21:30,2020-10-09 14:28:09,0,50.204.125.194,24,18398,0,2020-10-16 14:28:18,teacher_survey_response_2,,,,,,,anonymous,EN,1,1,4,160505,,,,,,,,,,,,,,,,,,,NA,,,,,NA,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
2020-12-06 8:28:00,2020-12-06 8:36:52,0,73.61.140.32,100,532,1,2020-12-06 8:36:52,teacher_survey_response_3,,,,,41.92610168,-71.30110168,anonymous,EN,1,2,2,350302,5,5,5,5,5,5,5,1,5,5,5,5,3,2,1,5,4,5,5,4,4,5,5,5,5,3,3,3,3,1,3,3,4,3,2,4,4,4,4,3,3,2,2,2,4,4,4,3,2,3,2,5,4,5,5,3,4,4,3,5,2,1,3,4,3,3,4,4,3,3,,9,9,
|
||||
2020-12-06 8:41:41,2020-12-06 8:51:25,0,96.230.183.162,100,584,1,2020-12-06 8:51:25,teacher_survey_response_4,,,,,41.98530579,-71.5184021,anonymous,EN,1,2,2,350302,5,5,5,4,4,4,4,1,4,4,4,4,3,3,3,2,5,2,4,5,4,5,4,4,4,3,3,3,3,4,4,3,3,3,3,3,4,3,3,4,4,3,2,4,4,4,4,4,3,2,3,4,5,3,2,2,4,4,3,3,4,3,3,3,3,3,3,4,3,3,,9,6,
|
||||
2020-12-06 8:44:42,2020-12-06 8:55:58,0,216.41.82.178,100,675,1,2020-12-06 8:55:58,teacher_survey_response_5,,,,,41.92610168,-71.30110168,anonymous,EN,1,2,2,350302,5,4,4,2,2,4,1,2,4,4,4,4,3,3,3,2,4,3,5,4,3,4,3,3,4,2,2,4,4,2,4,3,4,4,3,3,2,3,2,3,3,2,4,4,3,4,4,3,2,2,4,4,5,2,3,1,4,4,3,3,3,2,2,4,4,3,3,3,3,3,,7,5,"These questions are very difficult to address during a PANDEMIC! So it is not your average typical year. Our principal may not be as concerned about academics, because they are too busy navigating the complexities COVID has caused. I am honestly unsure why we would get surveyed during this time. "
|
||||
Start Date,End Date,Response Type,IP Address,Progress,Duration (in seconds),Finished,RecordedDate,ResponseId,Recipient Last Name,Recipient First Name,Recipient Email,External Data Reference,Location Latitude,Location Longitude,Distribution Channel,User Language,District,school,,DESE ID,t-prep-q1,t-prep-q2,t-prep-q3,t-pcom-q1,t-pcom-q2,t-pcom-q3,t-pcom-q4,t-pcom-q5,t-ieff-q1,t-ieff-q2,t-ieff-q3,t-ieff-q4,t-qupd-q3,t-qupd-q2,t-qupd-q1,t-qupd-q4,t-coll-q1,t-coll-q2,t-coll-q3,t-prtr-q1,t-prtr-q2,t-prtr-q3,t-inle-q1,t-inle-q2,t-inle-q3,t-pvic-q1,t-pvic-q2,t-pvic-q3,t-psup-q1,t-psup-q2,t-psup-q3,t-psup-q4,t-acch-q1,t-acch-q2,t-acch-q3,t-reso-q1,t-reso-q2,t-reso-q3,t-reso-q4,t-reso-q5,t-sust-q1,t-sust-q2,t-sust-q3,t-sust-q4,t-curv-q1,t-curv-q2,t-curv-q3,t-curv-q4,t-cure-q1,t-cure-q2,t-cure-q3,t-cure-q4,t-peng-q1,t-peng-q2,t-peng-q3,t-peng-q4,t-ceng-q1,t-ceng-q2,t-ceng-q3,t-ceng-q4,t-sach-q1,t-sach-q2,t-sach-q3,t-psol-q1,t-psol-q2,t-psol-q3,t-expa-q2,t-expa-q3,t-phya-q2,t-phya-q3,,,
|
||||
2020-10-09 9:42:45,2020-10-09 11:08:57,0,50.204.125.194,93,5172,0,2020-10-16 11:09:03,teacher_survey_response_1,,,,,,,anonymous,EN,1,1,4,1500025,,,,,,3,,,,,,,,,,,3,3,3,NA,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,,,,,,,,,,,
|
||||
2020-10-09 9:21:30,2020-10-09 14:28:09,0,50.204.125.194,24,18398,0,2020-10-16 14:28:18,teacher_survey_response_2,,,,,,,anonymous,EN,1,1,4,1500025,,,,,,,,,,,,,,,,,,,NA,,,,,NA,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
2020-12-06 8:28:00,2020-12-06 8:36:52,0,73.61.140.32,100,532,1,2020-12-06 8:36:52,teacher_survey_response_3,,,,,41.92610168,-71.30110168,anonymous,EN,1,2,2,1500505,5,5,5,5,5,5,5,1,5,5,5,5,3,2,1,5,4,5,5,4,4,5,5,5,5,3,3,3,3,1,3,3,4,3,2,4,4,4,4,3,3,2,2,2,4,4,4,3,2,3,2,5,4,5,5,3,4,4,3,5,2,1,3,4,3,3,4,4,3,3,,9,9
|
||||
2020-12-06 8:41:41,2020-12-06 8:51:25,0,96.230.183.162,100,584,1,2020-12-06 8:51:25,teacher_survey_response_4,,,,,41.98530579,-71.5184021,anonymous,EN,1,2,2,1500505,5,5,5,4,4,4,4,1,4,4,4,4,3,3,3,2,5,2,4,5,4,5,4,4,4,3,3,3,3,4,4,3,3,3,3,3,4,3,3,4,4,3,2,4,4,4,4,4,3,2,3,4,5,3,2,2,4,4,3,3,4,3,3,3,3,3,3,4,3,3,,9,6
|
||||
2020-12-06 8:44:42,2020-12-06 8:55:58,0,216.41.82.178,100,675,1,2020-12-06 8:55:58,teacher_survey_response_5,,,,,41.92610168,-71.30110168,anonymous,EN,1,2,2,1500505,5,4,4,2,2,4,1,2,4,4,4,4,3,3,3,2,4,3,5,4,3,4,3,3,4,2,2,4,4,2,4,3,4,4,3,3,2,3,2,3,3,2,4,4,3,4,4,3,2,2,4,4,5,2,3,1,4,4,3,3,3,2,2,4,4,3,3,3,3,3,,7,5
|
||||
|
|
|
|||
|
|
|
@ -1,9 +1,9 @@
|
|||
StartDate,EndDate,Status,IPAddress,Progress,Duration (in seconds),Finished,RecordedDate,ResponseId,District,School,"Please select the month, day and year of your birthday. - Month","Please select the month, day and year of your birthday. - Day","Please select the month, day and year of your birthday. - Year",LASID,Grade,s-emsa-q1,s-emsa-q2,s-emsa-q3,s-tint-q1,s-tint-q2,s-tint-q3,s-tint-q4,s-tint-q5,s-acpr-q1,s-acpr-q2,s-acpr-q3,s-acpr-q4,s-cure-q1,s-cure-q2,s-cure-q3,s-cure-q4,s-sten-q1,s-sten-q2,s-sten-q3,s-sper-q1,s-sper-q2,s-sper-q3,s-sper-q4,s-civp-q1,s-civp-q2,s-civp-q3,s-civp-q4,s-grmi-q1,s-grmi-q2,s-grmi-q3,s-grmi-q4,s-appa-q1,s-appa-q2,s-appa-q3,s-sbel-q1,s-sbel-q2,s-sbel-q3,s-sbel-q4,s-sbel-q5,s-phys-q1,s-phys-q2,s-phys-q3,s-phys-q4,s-vale-q1,s-vale-q2,s-vale-q3,s-vale-q4,s-acst-q1,s-acst-q2,s-acst-q3,s-sust-q1,s-sust-q2,s-grit-q1,s-grit-q2,s-grit-q3,s-grit-q4,s-expa-q1,s-poaf-q1,s-poaf-q2,s-poaf-q3,s-poaf-q4,s-peff-q1,s-peff-q2,s-peff-q3,s-peff-q4,s-peff-q5,s-peff-q6,Gender,Race
|
||||
2022-11-21 10:03:00,2022-11-21 10:12:16,0,208.118.224.220,100,555,1,2022-11-21T10:12:16,butler_student_survey_response_1,3,1600310,7,25,110,72509,7,3,3,,3,3,3,3,3,3,,3,3,3,3,3,3,2,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,,,,,,,,,,,,,,,,,,,3,3,3,3,3,3,1,3,3,3,3,,,,,,,2,
|
||||
2022-11-21 14:59:02,2022-11-21 15:08:02,0,71.233.3.7,40,540,0,2022-11-22T15:8:7,butler_student_survey_response_2,3,1600310,11,28,110,275751,7,,,,,,,,,,,,,,,,,,,,,,,,3,3,3,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
2022-11-21 10:03:34,2022-11-21 10:12:43,0,208.118.224.218,100,548,1,2022-11-21T10:12:44,butler_student_survey_response_3,3,1600310,9,28,110,277136,7,4,4,4,4,3,4,4,4,5,5,5,5,4,4,4,4,4,4,4,,4,4,4,3,3,3,3,4,4,4,4,2,4,3,4,4,4,4,3,,,,,,,,,,,,,,,,,,,,,,,5,5,5,4,5,5,1,2
|
||||
2022-11-21 14:59:02,2022-11-21 15:08:02,0,71.233.3.7,40,540,0,2022-11-22T15:8:7,butler_student_survey_response_2,3,1600310,11,28,110,275751,7,,,,,,,,,,,,,,,,,,,,,,,,3,3,3,2,,,,,,,,,,,,,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
2022-11-21 10:03:34,2022-11-21 10:12:43,0,208.118.224.218,100,548,1,2022-11-21T10:12:44,butler_student_survey_response_3,3,1600310,9,28,110,277136,7,4,4,4,4,3,4,4,4,5,5,5,5,4,4,4,4,4,4,4,,4,4,4,3,3,3,3,4,4,4,4,2,4,3,4,4,4,4,3,3,,,,,,,,,,,,,,,,,,,,,,5,5,5,4,5,5,1,2
|
||||
2022-11-18 11:06:49,2022-11-18 11:30:12,0,208.118.224.209,100,1402,1,2022-11-18T11:30:13,butler_student_survey_response_4,3,1600310,9,4,112,287185,5,3,3,3,4,3,5,5,5,5,4,5,4,4,3,4,4,3,4,4,2,3,3,3,4,4,4,4,3,3,3,3,3,3,3,3,3,4,3,3,,,,,,,,,,,,,,,,,,,,,,,5,4,4,4,4,4,1,2
|
||||
2022-11-21 13:12:42,2022-11-21 13:24:30,0,131.239.118.9,100,707,1,2022-11-21T13:24:31,butler_student_survey_response_5,3,1600310,12,19,110,297405,7,3,4,4,4,3,4,3,4,,,,,,,,,,,,,,,,,,,,3,4,4,4,,,,4,4,3,3,4,4,4,4,4,4,3,4,3,4,2,3,4,3,3,4,3,4,3,3,3,3,4,4,4,4,4,4,4,2,"2,4"
|
||||
2022-11-21 8:57:59,2022-11-21 9:02:56,0,131.239.118.46,40,297,0,2022-11-22T9:2:57,butler_student_survey_response_6,3,1600310,11,8,111,281578,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,,3,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
2022-11-21 8:57:59,2022-11-21 9:02:56,0,131.239.118.46,40,297,0,2022-11-22T9:2:57,butler_student_survey_response_6,3,1600310,11,8,111,281578,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,,3,4,,,,,,,,,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
2022-11-21 13:12:42,2022-11-21 13:24:30,0,131.239.118.9,100,707,1,2022-11-21T13:24:31,butler_student_survey_response_7,3,1600310,12,19,110,297405,,3,4,4,4,3,4,3,4,,,,,,,,,,,,,,,,,,,,3,4,4,4,,,,4,4,3,3,4,4,4,4,4,4,3,4,3,4,2,3,4,3,3,4,3,4,3,3,3,3,4,4,4,4,4,4,4,2,"2,4"
|
||||
2022-11-21 13:12:42,2022-11-21 13:24:30,0,131.239.118.9,100,707,1,2022-11-21T13:24:31,butler_student_survey_response_8,3,1600310,12,19,110,297405,0,3,4,4,4,3,4,3,4,,,,,,,,,,,,,,,,,,,,3,4,4,4,,,,4,4,3,3,4,4,4,4,4,4,3,4,3,4,2,3,4,3,3,4,3,4,3,3,3,3,4,4,4,4,4,4,4,2,"2,4"
|
||||
|
|
|
|||
|
|
|
@ -22,11 +22,11 @@ RSpec.describe AdminDataValue, type: :model do
|
|||
expect do
|
||||
AdminDataValue.create!(likert_score: 0, school:, admin_data_item:,
|
||||
academic_year:)
|
||||
end.to raise_error
|
||||
end.to raise_error 'Validation failed: Likert score must be greater than 0'
|
||||
expect do
|
||||
AdminDataValue.create!(likert_score: 5.00001, school:, admin_data_item:,
|
||||
academic_year:)
|
||||
end.to raise_error
|
||||
end.to raise_error 'Validation failed: Likert score must be less than or equal to 5'
|
||||
expect(AdminDataValue.count).to eq(0)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
||||
ENV["RAILS_ENV"] ||= "test"
|
||||
require File.expand_path("../config/environment", __dir__)
|
||||
ENV['RAILS_ENV'] ||= 'test'
|
||||
require File.expand_path('../config/environment', __dir__)
|
||||
# Prevent database truncation if the environment is production
|
||||
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
||||
require "spec_helper"
|
||||
require "rspec/rails"
|
||||
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
||||
abort('The Rails environment is running in production mode!') if Rails.env.production?
|
||||
require 'spec_helper'
|
||||
require 'rspec/rails'
|
||||
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
||||
# Add additional requires below this line. Rails is not loaded until this point!
|
||||
|
||||
# Requires supporting ruby files with custom matchers and macros, etc, in
|
||||
|
|
@ -27,7 +27,7 @@ Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
|||
# If you are not using ActiveRecord, you can remove this line.
|
||||
ActiveRecord::Migration.maintain_test_schema!
|
||||
|
||||
require "database_cleaner/active_record"
|
||||
require 'database_cleaner/active_record'
|
||||
|
||||
RSpec.configure do |config|
|
||||
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
||||
|
|
@ -68,11 +68,11 @@ RSpec.configure do |config|
|
|||
DatabaseCleaner.clean_with(:truncation)
|
||||
end
|
||||
|
||||
config.before(:each) do
|
||||
DatabaseCleaner.start
|
||||
config.before(:each) do |example|
|
||||
DatabaseCleaner.start unless example.metadata[:skip_db_cleaner]
|
||||
end
|
||||
|
||||
config.after(:each) do
|
||||
DatabaseCleaner.clean
|
||||
config.after(:each) do |example|
|
||||
DatabaseCleaner.clean unless example.metadata[:skip_db_cleaner]
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,119 +7,177 @@ describe SurveyResponsesDataLoader do
|
|||
Rails.root.join('spec', 'fixtures', 'test_2022-23_butler_student_survey_responses.csv')
|
||||
end
|
||||
|
||||
let(:ay_2020_21) { AcademicYear.find_by_range '2020-21' }
|
||||
let(:ay_2020_21) { create(:academic_year, range: '2020-21') }
|
||||
let(:ay_2022_23) { create(:academic_year, range: '2022-23') }
|
||||
|
||||
let(:attleboro_high_school) { School.find_by_slug 'attleboro-high-school' }
|
||||
let(:butler_middle_school) { School.find_by_slug 'butler-middle-school' }
|
||||
|
||||
let(:t_pcom_q3) { SurveyItem.find_by_survey_item_id 't-pcom-q3' }
|
||||
let(:t_pcom_q2) { SurveyItem.find_by_survey_item_id 't-pcom-q2' }
|
||||
let(:s_phys_q1) { SurveyItem.find_by_survey_item_id 's-phys-q1' }
|
||||
let(:s_phys_q2) { SurveyItem.find_by_survey_item_id 's-phys-q2' }
|
||||
|
||||
let(:female) { Gender.find_by_qualtrics_code 1 }
|
||||
let(:male) { Gender.find_by_qualtrics_code 2 }
|
||||
let(:another_gender) { Gender.find_by_qualtrics_code 3 }
|
||||
let(:non_binary) { Gender.find_by_qualtrics_code 4 }
|
||||
let(:unknown_gender) { Gender.find_by_qualtrics_code 99 }
|
||||
|
||||
before :all do
|
||||
Rails.application.load_seed
|
||||
let(:school) { create(:school, slug: 'lee-elementary-school', dese_id: 1_500_025) }
|
||||
let(:lowell) { create(:district, name: 'Lowell', slug: 'lowell') }
|
||||
let(:second_school) { create(:school, slug: 'lee-middle-high-school', dese_id: 1_500_505, district: lowell) }
|
||||
let(:butler_school) do
|
||||
create(:school, name: 'Butler Elementary School', slug: 'butler-elementary-school', dese_id: 1_600_310,
|
||||
district: lowell)
|
||||
end
|
||||
|
||||
after :each do
|
||||
DatabaseCleaner.clean
|
||||
let(:t_pcom_q3) { create(:survey_item, survey_item_id: 't-pcom-q3') }
|
||||
let(:t_pcom_q2) { create(:survey_item, survey_item_id: 't-pcom-q2') }
|
||||
let(:t_coll_q1) { create(:survey_item, survey_item_id: 't-coll-q1') }
|
||||
let(:t_coll_q2) { create(:survey_item, survey_item_id: 't-coll-q2') }
|
||||
let(:t_coll_q3) { create(:survey_item, survey_item_id: 't-coll-q3') }
|
||||
let(:t_sach_q1) { create(:survey_item, survey_item_id: 't-sach-q1') }
|
||||
let(:t_sach_q2) { create(:survey_item, survey_item_id: 't-sach-q2') }
|
||||
let(:t_sach_q3) { create(:survey_item, survey_item_id: 't-sach-q3') }
|
||||
|
||||
let(:s_phys_q1) { create(:survey_item, survey_item_id: 's-phys-q1') }
|
||||
let(:s_phys_q2) { create(:survey_item, survey_item_id: 's-phys-q2') }
|
||||
let(:s_phys_q3) { create(:survey_item, survey_item_id: 's-phys-q3') }
|
||||
let(:s_phys_q4) { create(:survey_item, survey_item_id: 's-phys-q4') }
|
||||
let(:s_vale_q1) { create(:survey_item, survey_item_id: 's-phys-q1') }
|
||||
let(:s_vale_q2) { create(:survey_item, survey_item_id: 's-phys-q2') }
|
||||
let(:s_vale_q3) { create(:survey_item, survey_item_id: 's-phys-q3') }
|
||||
let(:s_vale_q4) { create(:survey_item, survey_item_id: 's-phys-q4') }
|
||||
let(:s_acst_q1) { create(:survey_item, survey_item_id: 's-acst-q1') }
|
||||
let(:s_acst_q2) { create(:survey_item, survey_item_id: 's-acst-q2') }
|
||||
let(:s_acst_q3) { create(:survey_item, survey_item_id: 's-acst-q3') }
|
||||
let(:s_acst_q4) { create(:survey_item, survey_item_id: 's-acst-q4') }
|
||||
let(:s_emsa_q1) { create(:survey_item, survey_item_id: 's-emsa-q1') }
|
||||
let(:s_emsa_q2) { create(:survey_item, survey_item_id: 's-emsa-q2') }
|
||||
let(:s_emsa_q3) { create(:survey_item, survey_item_id: 's-emsa-q3') }
|
||||
|
||||
let(:female) { create(:gender, qualtrics_code: 1) }
|
||||
let(:male) { create(:gender, qualtrics_code: 2) }
|
||||
let(:another_gender) { create(:gender, qualtrics_code: 3) }
|
||||
let(:non_binary) { create(:gender, qualtrics_code: 4) }
|
||||
let(:unknown_gender) { create(:gender, qualtrics_code: 99) }
|
||||
|
||||
let(:setup) do
|
||||
ay_2020_21
|
||||
ay_2022_23
|
||||
school
|
||||
second_school
|
||||
butler_school
|
||||
t_pcom_q3
|
||||
t_pcom_q2
|
||||
t_coll_q1
|
||||
t_coll_q2
|
||||
t_coll_q3
|
||||
t_sach_q1
|
||||
t_sach_q2
|
||||
t_sach_q3
|
||||
s_phys_q1
|
||||
s_phys_q2
|
||||
s_phys_q3
|
||||
s_phys_q4
|
||||
s_vale_q1
|
||||
s_vale_q2
|
||||
s_vale_q3
|
||||
s_vale_q4
|
||||
s_acst_q1
|
||||
s_acst_q2
|
||||
s_acst_q3 # ./spec/services/survey_responses_data_loader_spec.rb:163:in `block (4 levels) in <top (required)>'
|
||||
s_acst_q4
|
||||
s_emsa_q1
|
||||
s_emsa_q2
|
||||
s_emsa_q3
|
||||
female
|
||||
male
|
||||
another_gender
|
||||
non_binary
|
||||
unknown_gender
|
||||
end
|
||||
|
||||
describe 'self.load_data' do
|
||||
context 'loading teacher survey responses' do
|
||||
before :each do
|
||||
SurveyResponsesDataLoader.load_data filepath: path_to_teacher_responses
|
||||
end
|
||||
it 'ensures teacher responses load correctly' do
|
||||
assigns_academic_year_to_survey_item_responses
|
||||
assigns_school_to_the_survey_item_responses
|
||||
loads_survey_item_responses_for_a_given_survey_response
|
||||
loads_all_survey_item_responses_for_a_given_survey_item
|
||||
captures_likert_scores_for_survey_item_responses
|
||||
is_idempotent
|
||||
end
|
||||
before :each do
|
||||
AcademicYear.reset_academic_years
|
||||
|
||||
setup
|
||||
end
|
||||
|
||||
describe 'loading teacher survey responses' do
|
||||
before do
|
||||
SurveyResponsesDataLoader.load_data filepath: path_to_teacher_responses
|
||||
end
|
||||
|
||||
context 'student survey responses' do
|
||||
before :each do
|
||||
SurveyResponsesDataLoader.load_data filepath: path_to_student_responses
|
||||
end
|
||||
it 'ensures teacher responses load correctly' do
|
||||
assigns_academic_year_to_survey_item_responses
|
||||
assigns_school_to_the_survey_item_responses
|
||||
loads_survey_item_responses_for_a_given_survey_response
|
||||
loads_all_survey_item_responses_for_a_given_survey_item
|
||||
captures_likert_scores_for_survey_item_responses
|
||||
is_idempotent
|
||||
end
|
||||
end
|
||||
|
||||
it 'ensures student responses load correctly' do
|
||||
assigns_academic_year_to_student_survey_item_responses
|
||||
assigns_school_to_student_survey_item_responses
|
||||
loads_student_survey_item_response_values
|
||||
student_survey_item_response_count_matches_expected
|
||||
captures_likert_scores_for_student_survey_item_responses
|
||||
assigns_grade_level_to_responses
|
||||
assigns_gender_to_responses
|
||||
is_idempotent_for_students
|
||||
end
|
||||
|
||||
context 'when updating student survey responses from another csv file' do
|
||||
before do
|
||||
SurveyResponsesDataLoader.load_data filepath: Rails.root.join('spec', 'fixtures',
|
||||
'secondary_test_2020-21_student_survey_responses.csv')
|
||||
end
|
||||
it 'updates the likert score to the score on the new csv file' do
|
||||
s_emsa_q1 = SurveyItem.find_by_survey_item_id 's-emsa-q1'
|
||||
expect(SurveyItemResponse.where(response_id: 'student_survey_response_3',
|
||||
survey_item: s_emsa_q1).first.likert_score).to eq 1
|
||||
expect(SurveyItemResponse.where(response_id: 'student_survey_response_4',
|
||||
survey_item: s_emsa_q1).first.likert_score).to eq 1
|
||||
expect(SurveyItemResponse.where(response_id: 'student_survey_response_5',
|
||||
survey_item: s_emsa_q1).first.likert_score).to eq 1
|
||||
end
|
||||
end
|
||||
describe 'student survey responses' do
|
||||
before do
|
||||
SurveyResponsesDataLoader.load_data filepath: path_to_student_responses
|
||||
end
|
||||
|
||||
# This file loads the seeder every time, which is slow. Turning it off since the above checks the correct behavior and the below will obviously fail when seeding lowell data
|
||||
# context 'when using Lowell rules to skip rows in the csv file' do
|
||||
# before :each do
|
||||
# SurveyResponsesDataLoader.load_data filepath: path_to_student_responses,
|
||||
# rules: [Rule::SkipNonLowellSchools]
|
||||
# end
|
||||
it 'ensures student responses load correctly' do
|
||||
assigns_academic_year_to_student_survey_item_responses
|
||||
assigns_school_to_student_survey_item_responses
|
||||
loads_student_survey_item_response_values
|
||||
student_survey_item_response_count_matches_expected
|
||||
captures_likert_scores_for_student_survey_item_responses
|
||||
assigns_grade_level_to_responses
|
||||
assigns_gender_to_responses
|
||||
is_idempotent_for_students
|
||||
end
|
||||
|
||||
# it 'rejects any non-lowell school' do
|
||||
# expect(SurveyItemResponse.where(response_id: 'student_survey_response_1').count).to eq 0
|
||||
# expect(SurveyItemResponse.count).to eq 128
|
||||
# end
|
||||
context 'when updating student survey responses from another csv file' do
|
||||
before :each do
|
||||
SurveyResponsesDataLoader.load_data filepath: Rails.root.join('spec', 'fixtures',
|
||||
'secondary_test_2020-21_student_survey_responses.csv')
|
||||
end
|
||||
it 'updates the likert score to the score on the new csv file' do
|
||||
s_emsa_q1 = SurveyItem.find_by_survey_item_id 's-emsa-q1'
|
||||
expect(SurveyItemResponse.where(response_id: 'student_survey_response_3',
|
||||
survey_item: s_emsa_q1).first.likert_score).to eq 1
|
||||
expect(SurveyItemResponse.where(response_id: 'student_survey_response_4',
|
||||
survey_item: s_emsa_q1).first.likert_score).to eq 2
|
||||
expect(SurveyItemResponse.where(response_id: 'student_survey_response_5',
|
||||
survey_item: s_emsa_q1).first.likert_score).to eq 2
|
||||
end
|
||||
end
|
||||
end
|
||||
# figure out why this is failing
|
||||
describe 'when using Lowell rules to skip rows in the csv file' do
|
||||
before :each do
|
||||
SurveyResponsesDataLoader.load_data filepath: path_to_student_responses,
|
||||
rules: [Rule::SkipNonLowellSchools]
|
||||
end
|
||||
|
||||
# it 'loads the correct number of responses for lowell schools' do
|
||||
# expect(SurveyItemResponse.where(response_id: 'student_survey_response_2').count).to eq 0
|
||||
# expect(SurveyItemResponse.where(response_id: 'student_survey_response_3').count).to eq 25
|
||||
# expect(SurveyItemResponse.where(response_id: 'student_survey_response_4').count).to eq 22
|
||||
# expect(SurveyItemResponse.where(response_id: 'student_survey_response_5').count).to eq 27
|
||||
# end
|
||||
it 'rejects any non-lowell school' do
|
||||
expect(SurveyItemResponse.where(response_id: 'student_survey_response_1').count).to eq 0
|
||||
expect(SurveyItemResponse.count).to eq 69
|
||||
end
|
||||
|
||||
# context 'when loading 22-23 butler survey responses' do
|
||||
# before :each do
|
||||
# SurveyResponsesDataLoader.load_data filepath: path_to_butler_student_responses,
|
||||
# rules: [Rule::SkipNonLowellSchools]
|
||||
# end
|
||||
it 'loads the correct number of responses for lowell schools' do
|
||||
expect(SurveyItemResponse.where(response_id: 'student_survey_response_2').count).to eq 0
|
||||
expect(SurveyItemResponse.where(response_id: 'student_survey_response_3').count).to eq 12
|
||||
expect(SurveyItemResponse.where(response_id: 'student_survey_response_4').count).to eq 15
|
||||
expect(SurveyItemResponse.where(response_id: 'student_survey_response_5').count).to eq 14
|
||||
end
|
||||
|
||||
# it 'loads all the responses for Butler' do
|
||||
# expect(SurveyItemResponse.count).to eq 400
|
||||
# end
|
||||
context 'when loading 22-23 butler survey responses' do
|
||||
before :each do
|
||||
SurveyResponsesDataLoader.load_data filepath: path_to_butler_student_responses,
|
||||
rules: [Rule::SkipNonLowellSchools]
|
||||
end
|
||||
|
||||
# it 'blank entries for grade get loaded as nils, not zero values' do
|
||||
# expect(SurveyItemResponse.where(response_id: 'butler_student_survey_response_1').first.grade).to eq 7
|
||||
# expect(SurveyItemResponse.where(response_id: 'butler_student_survey_response_2').first.grade).to eq 7
|
||||
# expect(SurveyItemResponse.where(response_id: 'butler_student_survey_response_3').first.grade).to eq 7
|
||||
# expect(SurveyItemResponse.where(response_id: 'butler_student_survey_response_4').first.grade).to eq 5
|
||||
# expect(SurveyItemResponse.where(response_id: 'butler_student_survey_response_5').first.grade).to eq 7
|
||||
# expect(SurveyItemResponse.where(response_id: 'butler_student_survey_response_6').first.grade).to eq 6
|
||||
# expect(SurveyItemResponse.where(response_id: 'butler_student_survey_response_7').first.grade).to eq nil
|
||||
# expect(SurveyItemResponse.where(response_id: 'butler_student_survey_response_8').first.grade).to eq 0
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
it 'loads all the responses for Butler' do
|
||||
expect(SurveyItemResponse.where(school: butler_school).count).to eq 56
|
||||
end
|
||||
|
||||
it 'blank entries for grade get loaded as nils, not zero values' do
|
||||
expect(SurveyItemResponse.where(response_id: 'butler_student_survey_response_1').first.grade).to eq 7
|
||||
expect(SurveyItemResponse.where(response_id: 'butler_student_survey_response_2').first.grade).to eq 7
|
||||
expect(SurveyItemResponse.where(response_id: 'butler_student_survey_response_3').first.grade).to eq 7
|
||||
expect(SurveyItemResponse.where(response_id: 'butler_student_survey_response_4').first.grade).to eq 5
|
||||
expect(SurveyItemResponse.where(response_id: 'butler_student_survey_response_5').first.grade).to eq 7
|
||||
expect(SurveyItemResponse.where(response_id: 'butler_student_survey_response_6').first.grade).to eq 6
|
||||
expect(SurveyItemResponse.where(response_id: 'butler_student_survey_response_7').first.grade).to eq nil
|
||||
expect(SurveyItemResponse.where(response_id: 'butler_student_survey_response_8').first.grade).to eq 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -128,15 +186,15 @@ def assigns_academic_year_to_survey_item_responses
|
|||
end
|
||||
|
||||
def assigns_school_to_the_survey_item_responses
|
||||
expect(SurveyItemResponse.find_by_response_id('teacher_survey_response_1').school).to eq attleboro_high_school
|
||||
expect(SurveyItemResponse.find_by_response_id('teacher_survey_response_1').school).to eq school
|
||||
end
|
||||
|
||||
def loads_survey_item_responses_for_a_given_survey_response
|
||||
expect(SurveyItemResponse.where(response_id: 'teacher_survey_response_1').count).to eq 5
|
||||
expect(SurveyItemResponse.where(response_id: 'teacher_survey_response_2').count).to eq 0
|
||||
expect(SurveyItemResponse.where(response_id: 'teacher_survey_response_3').count).to eq 69
|
||||
expect(SurveyItemResponse.where(response_id: 'teacher_survey_response_4').count).to eq 69
|
||||
expect(SurveyItemResponse.where(response_id: 'teacher_survey_response_5').count).to eq 69
|
||||
expect(SurveyItemResponse.where(response_id: 'teacher_survey_response_3').count).to eq 8
|
||||
expect(SurveyItemResponse.where(response_id: 'teacher_survey_response_4').count).to eq 8
|
||||
expect(SurveyItemResponse.where(response_id: 'teacher_survey_response_5').count).to eq 8
|
||||
end
|
||||
|
||||
def loads_all_survey_item_responses_for_a_given_survey_item
|
||||
|
|
@ -174,15 +232,15 @@ def assigns_academic_year_to_student_survey_item_responses
|
|||
end
|
||||
|
||||
def assigns_school_to_student_survey_item_responses
|
||||
expect(SurveyItemResponse.find_by_response_id('student_survey_response_3').school).to eq butler_middle_school
|
||||
expect(SurveyItemResponse.find_by_response_id('student_survey_response_3').school).to eq second_school
|
||||
end
|
||||
|
||||
def loads_student_survey_item_response_values
|
||||
expect(SurveyItemResponse.where(response_id: 'student_survey_response_1').count).to eq 3
|
||||
expect(SurveyItemResponse.where(response_id: 'student_survey_response_2').count).to eq 0
|
||||
expect(SurveyItemResponse.where(response_id: 'student_survey_response_3').count).to eq 25
|
||||
expect(SurveyItemResponse.where(response_id: 'student_survey_response_4').count).to eq 22
|
||||
expect(SurveyItemResponse.where(response_id: 'student_survey_response_5').count).to eq 27
|
||||
expect(SurveyItemResponse.where(response_id: 'student_survey_response_3').count).to eq 12
|
||||
expect(SurveyItemResponse.where(response_id: 'student_survey_response_4').count).to eq 15
|
||||
expect(SurveyItemResponse.where(response_id: 'student_survey_response_5').count).to eq 14
|
||||
end
|
||||
|
||||
def student_survey_item_response_count_matches_expected
|
||||
|
|
@ -241,3 +299,4 @@ def assigns_gender_to_responses
|
|||
expect(SurveyItemResponse.where(response_id: key).first.gender).to eq value
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue