feat: add popover to analyze graphs that displays the n-size of the different columns. Make sure to only calculate a score for a race if there are more than 10 respondents to a question.
parent
45e324e7d2
commit
a0807295ed
@ -0,0 +1,18 @@
|
||||
module Analyze
|
||||
module Graph
|
||||
module Column
|
||||
module GenderColumn
|
||||
module GenderCount
|
||||
def type
|
||||
:student
|
||||
end
|
||||
|
||||
def n_size(year_index)
|
||||
SurveyItemResponse.where(gender:, survey_item: measure.student_survey_items, school:, grade: grades(year_index),
|
||||
academic_year: academic_years[year_index]).select(:response_id).distinct.count
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -0,0 +1,18 @@
|
||||
module Analyze
|
||||
module Graph
|
||||
module Column
|
||||
module Grade
|
||||
module GradeCount
|
||||
def type
|
||||
:student
|
||||
end
|
||||
|
||||
def n_size(year_index)
|
||||
SurveyItemResponse.where(grade:, survey_item: measure.student_survey_items, school:,
|
||||
academic_year: academic_years[year_index]).select(:response_id).distinct.count
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -0,0 +1,18 @@
|
||||
module Analyze
|
||||
module Graph
|
||||
module Column
|
||||
module IncomeColumn
|
||||
module IncomeCount
|
||||
def type
|
||||
:student
|
||||
end
|
||||
|
||||
def n_size(year_index)
|
||||
SurveyItemResponse.where(income:, survey_item: measure.student_survey_items, school:, grade: grades(year_index),
|
||||
academic_year: academic_years[year_index]).select(:response_id).distinct.count
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -0,0 +1,20 @@
|
||||
module Analyze
|
||||
module Graph
|
||||
module Column
|
||||
module RaceColumn
|
||||
module RaceCount
|
||||
def type
|
||||
:student
|
||||
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(
|
||||
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
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -0,0 +1,15 @@
|
||||
describe('navigates the analyze page', () => {
|
||||
it('it displays counts of students and teacher in the hovers', () => {
|
||||
|
||||
login("/districts/lee-public-schools/schools/lee-elementary-school/analyze?year=2022-23&academic_years=2022-23", "bGVlOmxlZSE=")
|
||||
})
|
||||
})
|
||||
|
||||
function login(path, credentials) {
|
||||
cy.visit(path, {
|
||||
headers: {
|
||||
authorization: `Basic ${credentials}`
|
||||
},
|
||||
failOnStatusCode: false
|
||||
})
|
||||
}
|
||||
Loading…
Reference in new issue