feat: update survey_item_response table to indlude recorded date and import recorded date when loading responses

This commit is contained in:
rebuilt 2023-06-23 11:26:53 -07:00
parent 8bc14a79f6
commit e8aa75bf66
4 changed files with 42 additions and 4 deletions

View file

@ -97,6 +97,7 @@ describe SurveyResponsesDataLoader do
it "ensures teacher responses load correctly" do
assigns_academic_year_to_survey_item_responses
assigns_school_to_the_survey_item_responses
assigns_recorded_date_to_teacher_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
@ -112,6 +113,7 @@ describe SurveyResponsesDataLoader do
it "ensures student responses load correctly" do
assigns_academic_year_to_student_survey_item_responses
assigns_school_to_student_survey_item_responses
assigns_recorded_date_to_student_responses
loads_student_survey_item_response_values
student_survey_item_response_count_matches_expected
captures_likert_scores_for_student_survey_item_responses
@ -297,3 +299,25 @@ def assigns_gender_to_responses
expect(SurveyItemResponse.where(response_id: key).first.gender).to eq value
end
end
def assigns_recorded_date_to_student_responses
results = {"student_survey_response_1" => "2020-09-30T18:48:50",
"student_survey_response_3" => "2021-03-31T09:59:02",
"student_survey_response_4" => "2021-03-31T10:00:17",
"student_survey_response_5" => "2021-03-31T10:01:36",
"student_survey_response_6" => "2021-03-31T10:01:37",
"student_survey_response_7" => "2021-03-31T10:01:38"}
results.each do |key, value|
expect(SurveyItemResponse.find_by_response_id(key).recorded_date).to eq Date.parse(value)
end
end
def assigns_recorded_date_to_teacher_responses
results = {"teacher_survey_response_1" => "2020-10-16 11:09:03",
"teacher_survey_response_3" => "2020-12-06 8:36:52",
"teacher_survey_response_4" => "2020-12-06 8:51:25",
"teacher_survey_response_5" => "2020-12-06 8:55:58"}
results.each do |key, value|
expect(SurveyItemResponse.find_by_response_id(key).recorded_date).to eq Date.parse(value)
end
end