chore: show all disaggregations without error on analyze page

This commit is contained in:
Nelson Jovel 2024-01-31 15:06:16 -08:00
parent 25e1a940b3
commit 8a8bd4846c
7 changed files with 20 additions and 17 deletions

View file

@ -11,10 +11,10 @@ module Dashboard
end
def n_size(year_index)
SurveyItemResponse.joins("JOIN student_races on survey_item_responses.student_id = student_races.student_id JOIN students on students.id = student_races.student_id").where(
SurveyItemResponse.joins("JOIN dashboard_student_races on dashboard_survey_item_responses.dashboard_student_id = dashboard_student_races.dashboard_student_id JOIN dashboard_students on dashboard_students.id = dashboard_student_races.dashboard_student_id").where(
school:, academic_year: academic_years[year_index],
survey_item: measure.student_survey_items
).where("student_races.race_id": race.id).select(:response_id).distinct.count
).where("dashboard_student_races.dashboard_race_id": race.id).select(:response_id).distinct.count
end
end
end

View file

@ -32,9 +32,9 @@ module Dashboard
def sufficient_student_responses?(academic_year:)
return false unless measure.subcategory.response_rate(school:, academic_year:).meets_student_threshold?
number_of_students_for_a_racial_group = SurveyItemResponse.joins("JOIN student_races on dashboard_survey_item_responses.student_id = student_races.student_id JOIN students on students.id = student_races.student_id").where(
number_of_students_for_a_racial_group = SurveyItemResponse.joins("JOIN dashboard_student_races on dashboard_survey_item_responses.dashboard_student_id = dashboard_student_races.dashboard_student_id JOIN dashboard_students on dashboard_students.id = dashboard_student_races.dashboard_student_id").where(
school:, academic_year:
).where("student_races.race_id": race.id).distinct.pluck(:student_id).count
).where("dashboard_student_races.dashboard_race_id": race.id).distinct.pluck(:dashboard_student_id).count
number_of_students_for_a_racial_group >= 10
end
end