mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Show parent response rate
This commit is contained in:
parent
7d4db37ee7
commit
0c661930e9
14 changed files with 113 additions and 50 deletions
|
|
@ -15,5 +15,6 @@ class OverviewController < SqmApplicationController
|
||||||
@category_presenters = @page.category_presenters
|
@category_presenters = @page.category_presenters
|
||||||
@student_response_rate_presenter = @page.student_response_rate_presenter
|
@student_response_rate_presenter = @page.student_response_rate_presenter
|
||||||
@teacher_response_rate_presenter = @page.teacher_response_rate_presenter
|
@teacher_response_rate_presenter = @page.teacher_response_rate_presenter
|
||||||
|
@parent_response_rate_presenter = @page.parent_response_rate_presenter
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
2
app/models/parent.rb
Normal file
2
app/models/parent.rb
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
class Parent < ApplicationRecord
|
||||||
|
end
|
||||||
|
|
@ -8,6 +8,7 @@ class SurveyItemResponse < ActiveRecord::Base
|
||||||
belongs_to :school
|
belongs_to :school
|
||||||
belongs_to :survey_item, counter_cache: true
|
belongs_to :survey_item, counter_cache: true
|
||||||
belongs_to :student, foreign_key: :student_id, optional: true
|
belongs_to :student, foreign_key: :student_id, optional: true
|
||||||
|
belongs_to :parent, optional: true
|
||||||
belongs_to :gender, optional: true
|
belongs_to :gender, optional: true
|
||||||
belongs_to :income, optional: true
|
belongs_to :income, optional: true
|
||||||
belongs_to :ell, optional: true
|
belongs_to :ell, optional: true
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class Overview::OverviewPresenter
|
||||||
"school-quality-frameworks"
|
"school-quality-frameworks"
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_response_rates
|
def show_student_response_rates
|
||||||
view == "student"
|
view == "student"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -43,6 +43,10 @@ class Overview::OverviewPresenter
|
||||||
ResponseRatePresenter.new(focus: :teacher, school: @school, academic_year: @academic_year)
|
ResponseRatePresenter.new(focus: :teacher, school: @school, academic_year: @academic_year)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def parent_response_rate_presenter
|
||||||
|
ResponseRatePresenter.new(focus: :parent, school: @school, academic_year: @academic_year)
|
||||||
|
end
|
||||||
|
|
||||||
def presenter_for_measure(measure)
|
def presenter_for_measure(measure)
|
||||||
score = measure.score(school: @school, academic_year: @academic_year)
|
score = measure.score(school: @school, academic_year: @academic_year)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ class ResponseRatePresenter
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@survey_items = SurveyItem.teacher_survey_items if focus == :teacher
|
@survey_items = SurveyItem.teacher_survey_items if focus == :teacher
|
||||||
|
@survey_items = SurveyItem.parent_survey_items if focus == :parent
|
||||||
end
|
end
|
||||||
|
|
||||||
def date
|
def date
|
||||||
|
|
@ -49,6 +50,12 @@ class ResponseRatePresenter
|
||||||
def actual_count
|
def actual_count
|
||||||
if focus == :teacher
|
if focus == :teacher
|
||||||
response_count_for_survey_items(survey_items:)
|
response_count_for_survey_items(survey_items:)
|
||||||
|
elsif focus == :parent
|
||||||
|
SurveyItemResponse.includes(:parent).where(school:, academic_year:).where.not(parent_id: nil)
|
||||||
|
.select(:parent_id)
|
||||||
|
.distinct
|
||||||
|
.map { |response| response.parent&.number_of_children }
|
||||||
|
.compact.sum
|
||||||
else
|
else
|
||||||
non_early_ed_items = survey_items - SurveyItem.early_education_survey_items
|
non_early_ed_items = survey_items - SurveyItem.early_education_survey_items
|
||||||
non_early_ed_count = response_count_for_survey_items(survey_items: non_early_ed_items)
|
non_early_ed_count = response_count_for_survey_items(survey_items: non_early_ed_items)
|
||||||
|
|
@ -81,7 +88,7 @@ class ResponseRatePresenter
|
||||||
def respondents_count
|
def respondents_count
|
||||||
return 0 if respondents.nil?
|
return 0 if respondents.nil?
|
||||||
|
|
||||||
count = enrollment if focus == :student
|
count = enrollment if focus == :student || focus == :parent
|
||||||
count = respondents.total_teachers if focus == :teacher
|
count = respondents.total_teachers if focus == :teacher
|
||||||
count
|
count
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -67,11 +67,7 @@ class SurveyItemValues
|
||||||
end
|
end
|
||||||
|
|
||||||
def survey_item_response(survey_item:)
|
def survey_item_response(survey_item:)
|
||||||
@survey_item_response ||= Hash.new do |memo, survey_item|
|
survey_item_responses[[response_id, survey_item.id]]
|
||||||
memo[survey_item] = survey_item_responses[[response_id, survey_item.id]]
|
|
||||||
end
|
|
||||||
|
|
||||||
@survey_item_response[survey_item]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def survey_item_responses
|
def survey_item_responses
|
||||||
|
|
@ -192,6 +188,10 @@ class SurveyItemValues
|
||||||
@sped ||= Sped.to_designation(raw_sped)
|
@sped ||= Sped.to_designation(raw_sped)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def number_of_children
|
||||||
|
@number_of_children ||= value_from(pattern: /Number\s*Of\s*Children/i).to_i
|
||||||
|
end
|
||||||
|
|
||||||
def value_from(pattern:)
|
def value_from(pattern:)
|
||||||
output = nil
|
output = nil
|
||||||
matches = headers.select do |header|
|
matches = headers.select do |header|
|
||||||
|
|
|
||||||
|
|
@ -87,10 +87,20 @@ class SurveyResponsesDataLoader
|
||||||
end
|
end
|
||||||
|
|
||||||
def process_survey_items(row:)
|
def process_survey_items(row:)
|
||||||
student = Student.find_or_create_by(response_id: row.response_id, lasid: row.lasid)
|
student = nil
|
||||||
student.races.delete_all
|
parent = nil
|
||||||
tmp_races = row.races.map { |race| races[race] }
|
if row.respondent_type == :student
|
||||||
student.races += tmp_races
|
student = Student.find_or_create_by(response_id: row.response_id, lasid: row.lasid)
|
||||||
|
student.races.delete_all
|
||||||
|
tmp_races = row.races.map { |race| races[race] }
|
||||||
|
student.races += tmp_races
|
||||||
|
end
|
||||||
|
|
||||||
|
if row.respondent_type == :parent
|
||||||
|
parent = Parent.find_or_create_by(response_id: row.response_id)
|
||||||
|
parent.number_of_children = row.number_of_children
|
||||||
|
parent.save
|
||||||
|
end
|
||||||
|
|
||||||
row
|
row
|
||||||
.survey_items
|
.survey_items
|
||||||
|
|
@ -103,12 +113,12 @@ class SurveyResponsesDataLoader
|
||||||
end
|
end
|
||||||
|
|
||||||
response = row.survey_item_response(survey_item:)
|
response = row.survey_item_response(survey_item:)
|
||||||
create_or_update_response(survey_item_response: response, likert_score:, row:, survey_item:, student:)
|
create_or_update_response(survey_item_response: response, likert_score:, row:, survey_item:, student:, parent:)
|
||||||
end
|
end
|
||||||
.compact
|
.compact
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_or_update_response(survey_item_response:, likert_score:, row:, survey_item:, student:)
|
def create_or_update_response(survey_item_response:, likert_score:, row:, survey_item:, student:, parent:)
|
||||||
gender = genders[row.gender]
|
gender = genders[row.gender]
|
||||||
grade = row.grade
|
grade = row.grade
|
||||||
income = incomes[row.income.parameterize]
|
income = incomes[row.income.parameterize]
|
||||||
|
|
@ -124,6 +134,8 @@ class SurveyResponsesDataLoader
|
||||||
survey_item_response.ell = ell
|
survey_item_response.ell = ell
|
||||||
survey_item_response.sped = sped
|
survey_item_response.sped = sped
|
||||||
survey_item_response.student = student
|
survey_item_response.student = student
|
||||||
|
survey_item_response.parent = parent
|
||||||
|
|
||||||
survey_item_response
|
survey_item_response
|
||||||
else
|
else
|
||||||
SurveyItemResponse.new(
|
SurveyItemResponse.new(
|
||||||
|
|
@ -138,7 +150,8 @@ class SurveyResponsesDataLoader
|
||||||
income:,
|
income:,
|
||||||
ell:,
|
ell:,
|
||||||
sped:,
|
sped:,
|
||||||
student:
|
student:,
|
||||||
|
parent:
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,15 @@
|
||||||
</div>
|
</div>
|
||||||
<%= render partial: "quality_framework_indicators", locals: { category_presenters: @category_presenters } %>
|
<%= render partial: "quality_framework_indicators", locals: { category_presenters: @category_presenters } %>
|
||||||
|
|
||||||
<% if @page.show_response_rates %>
|
<% if @page.show_student_response_rates %>
|
||||||
<div class="overall-response-rate-row">
|
<div class="overall-response-rate-row">
|
||||||
<%= render partial: "response_rate", locals: {response_rate_presenter: @student_response_rate_presenter} %>
|
<%= render partial: "response_rate", locals: {response_rate_presenter: @student_response_rate_presenter} %>
|
||||||
<%= render partial: "response_rate", locals: {response_rate_presenter: @teacher_response_rate_presenter} %>
|
<%= render partial: "response_rate", locals: {response_rate_presenter: @teacher_response_rate_presenter} %>
|
||||||
</div>
|
</div>
|
||||||
|
<% else %>
|
||||||
|
<div class="overall-response-rate-row">
|
||||||
|
<%= render partial: "response_rate", locals: {response_rate_presenter: @parent_response_rate_presenter} %>
|
||||||
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
10
db/migrate/20241031190531_create_parents.rb
Normal file
10
db/migrate/20241031190531_create_parents.rb
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
class CreateParents < ActiveRecord::Migration[7.1]
|
||||||
|
def change
|
||||||
|
create_table :parents do |t|
|
||||||
|
t.string :response_id
|
||||||
|
t.integer :number_of_children
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddParentToSurveyItemResponse < ActiveRecord::Migration[7.1]
|
||||||
|
def change
|
||||||
|
add_reference :survey_item_responses, :parent, foreign_key: true
|
||||||
|
end
|
||||||
|
end
|
||||||
12
db/schema.rb
12
db/schema.rb
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.1].define(version: 2024_09_24_173209) do
|
ActiveRecord::Schema[7.1].define(version: 2024_10_31_205926) do
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
|
||||||
|
|
@ -316,6 +316,13 @@ ActiveRecord::Schema[7.1].define(version: 2024_09_24_173209) do
|
||||||
t.index ["subcategory_id"], name: "index_measures_on_subcategory_id"
|
t.index ["subcategory_id"], name: "index_measures_on_subcategory_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "parents", force: :cascade do |t|
|
||||||
|
t.string "response_id"
|
||||||
|
t.integer "number_of_children"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
create_table "races", force: :cascade do |t|
|
create_table "races", force: :cascade do |t|
|
||||||
t.string "designation"
|
t.string "designation"
|
||||||
t.integer "qualtrics_code"
|
t.integer "qualtrics_code"
|
||||||
|
|
@ -461,10 +468,12 @@ ActiveRecord::Schema[7.1].define(version: 2024_09_24_173209) do
|
||||||
t.datetime "recorded_date"
|
t.datetime "recorded_date"
|
||||||
t.bigint "ell_id"
|
t.bigint "ell_id"
|
||||||
t.bigint "sped_id"
|
t.bigint "sped_id"
|
||||||
|
t.bigint "parent_id"
|
||||||
t.index ["academic_year_id"], name: "index_survey_item_responses_on_academic_year_id"
|
t.index ["academic_year_id"], name: "index_survey_item_responses_on_academic_year_id"
|
||||||
t.index ["ell_id"], name: "index_survey_item_responses_on_ell_id"
|
t.index ["ell_id"], name: "index_survey_item_responses_on_ell_id"
|
||||||
t.index ["gender_id"], name: "index_survey_item_responses_on_gender_id"
|
t.index ["gender_id"], name: "index_survey_item_responses_on_gender_id"
|
||||||
t.index ["income_id"], name: "index_survey_item_responses_on_income_id"
|
t.index ["income_id"], name: "index_survey_item_responses_on_income_id"
|
||||||
|
t.index ["parent_id"], name: "index_survey_item_responses_on_parent_id"
|
||||||
t.index ["response_id"], name: "index_survey_item_responses_on_response_id"
|
t.index ["response_id"], name: "index_survey_item_responses_on_response_id"
|
||||||
t.index ["school_id", "academic_year_id", "survey_item_id"], name: "by_school_year_and_survey_item"
|
t.index ["school_id", "academic_year_id", "survey_item_id"], name: "by_school_year_and_survey_item"
|
||||||
t.index ["school_id", "survey_item_id", "academic_year_id", "grade"], name: "index_survey_responses_on_grade"
|
t.index ["school_id", "survey_item_id", "academic_year_id", "grade"], name: "index_survey_responses_on_grade"
|
||||||
|
|
@ -516,6 +525,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_09_24_173209) do
|
||||||
add_foreign_key "survey_item_responses", "ells"
|
add_foreign_key "survey_item_responses", "ells"
|
||||||
add_foreign_key "survey_item_responses", "genders"
|
add_foreign_key "survey_item_responses", "genders"
|
||||||
add_foreign_key "survey_item_responses", "incomes"
|
add_foreign_key "survey_item_responses", "incomes"
|
||||||
|
add_foreign_key "survey_item_responses", "parents"
|
||||||
add_foreign_key "survey_item_responses", "schools"
|
add_foreign_key "survey_item_responses", "schools"
|
||||||
add_foreign_key "survey_item_responses", "speds"
|
add_foreign_key "survey_item_responses", "speds"
|
||||||
add_foreign_key "survey_item_responses", "students"
|
add_foreign_key "survey_item_responses", "students"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,9 @@
|
||||||
FactoryBot.define do
|
FactoryBot.define do
|
||||||
|
factory :parent do
|
||||||
|
response_id { "MyString" }
|
||||||
|
number_of_children { 1 }
|
||||||
|
end
|
||||||
|
|
||||||
factory :income do
|
factory :income do
|
||||||
designation { "DefaultIncome" }
|
designation { "DefaultIncome" }
|
||||||
end
|
end
|
||||||
|
|
|
||||||
5
spec/models/parent_spec.rb
Normal file
5
spec/models/parent_spec.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe Parent, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
|
|
@ -21,6 +21,27 @@ describe SurveyResponsesDataLoader do
|
||||||
district: lowell)
|
district: lowell)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
let(:student_survey_items) do
|
||||||
|
ids = %w[ s-emsa-q1 s-emsa-q2 s-emsa-q3
|
||||||
|
s-tint-q1 s-tint-q2 s-tint-q4 s-tint-q5
|
||||||
|
s-acpr-q1 s-acpr-q2 s-acpr-q3 s-acpr-q4
|
||||||
|
s-cure-q3 s-cure-q4 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-q4 s-appa-q1
|
||||||
|
s-appa-q2 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-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]
|
||||||
|
|
||||||
|
ids.each do |id|
|
||||||
|
create(:survey_item, survey_item_id: id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
let(:t_pcom_q3) { create(:survey_item, survey_item_id: "t-pcom-q3") }
|
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_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_q1) { create(:survey_item, survey_item_id: "t-coll-q1") }
|
||||||
|
|
@ -30,22 +51,6 @@ describe SurveyResponsesDataLoader do
|
||||||
let(:t_sach_q2) { create(:survey_item, survey_item_id: "t-sach-q2") }
|
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(: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(:female) { create(:gender, qualtrics_code: 1) }
|
||||||
let(:male) { create(:gender, qualtrics_code: 2) }
|
let(:male) { create(:gender, qualtrics_code: 2) }
|
||||||
let(:another_gender) { create(:gender, qualtrics_code: 3) }
|
let(:another_gender) { create(:gender, qualtrics_code: 3) }
|
||||||
|
|
@ -83,21 +88,7 @@ describe SurveyResponsesDataLoader do
|
||||||
t_sach_q1
|
t_sach_q1
|
||||||
t_sach_q2
|
t_sach_q2
|
||||||
t_sach_q3
|
t_sach_q3
|
||||||
s_phys_q1
|
student_survey_items
|
||||||
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_emsa_q1
|
|
||||||
s_emsa_q2
|
|
||||||
s_emsa_q3
|
|
||||||
|
|
||||||
female
|
female
|
||||||
male
|
male
|
||||||
|
|
@ -170,6 +161,7 @@ describe SurveyResponsesDataLoader do
|
||||||
end
|
end
|
||||||
it "updates the likert score to the score on the new csv file" do
|
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"
|
s_emsa_q1 = SurveyItem.find_by_survey_item_id "s-emsa-q1"
|
||||||
|
s_acst_q3 = SurveyItem.find_by_survey_item_id "s-acst-q3"
|
||||||
expect(SurveyItemResponse.where(response_id: "student_survey_response_3",
|
expect(SurveyItemResponse.where(response_id: "student_survey_response_3",
|
||||||
survey_item: s_emsa_q1).first.likert_score).to eq 1
|
survey_item: s_emsa_q1).first.likert_score).to eq 1
|
||||||
expect(SurveyItemResponse.where(response_id: "student_survey_response_4",
|
expect(SurveyItemResponse.where(response_id: "student_survey_response_4",
|
||||||
|
|
@ -241,17 +233,21 @@ end
|
||||||
def loads_student_survey_item_response_values
|
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_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_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_3").count).to eq 30
|
||||||
expect(SurveyItemResponse.where(response_id: "student_survey_response_4").count).to eq 15
|
expect(SurveyItemResponse.where(response_id: "student_survey_response_4").count).to eq 27
|
||||||
expect(SurveyItemResponse.where(response_id: "student_survey_response_5").count).to eq 14
|
expect(SurveyItemResponse.where(response_id: "student_survey_response_5").count).to eq 30
|
||||||
end
|
end
|
||||||
|
|
||||||
def student_survey_item_response_count_matches_expected
|
def student_survey_item_response_count_matches_expected
|
||||||
|
s_phys_q1 = SurveyItem.where(survey_item_id: "s-phys-q1")
|
||||||
|
s_phys_q2 = SurveyItem.where(survey_item_id: "s-phys-q2")
|
||||||
expect(SurveyItemResponse.where(survey_item: s_phys_q1).count).to eq 6
|
expect(SurveyItemResponse.where(survey_item: s_phys_q1).count).to eq 6
|
||||||
expect(SurveyItemResponse.where(survey_item: s_phys_q2).count).to eq 5
|
expect(SurveyItemResponse.where(survey_item: s_phys_q2).count).to eq 5
|
||||||
end
|
end
|
||||||
|
|
||||||
def captures_likert_scores_for_student_survey_item_responses
|
def captures_likert_scores_for_student_survey_item_responses
|
||||||
|
s_phys_q1 = SurveyItem.where(survey_item_id: "s-phys-q1")
|
||||||
|
s_phys_q2 = SurveyItem.where(survey_item_id: "s-phys-q2")
|
||||||
expect(SurveyItemResponse.where(response_id: "student_survey_response_1").where(survey_item: s_phys_q1).first.likert_score).to eq 3
|
expect(SurveyItemResponse.where(response_id: "student_survey_response_1").where(survey_item: s_phys_q1).first.likert_score).to eq 3
|
||||||
expect(SurveyItemResponse.where(response_id: "student_survey_response_1").where(survey_item: s_phys_q2)).to be_empty
|
expect(SurveyItemResponse.where(response_id: "student_survey_response_1").where(survey_item: s_phys_q2)).to be_empty
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue