mirror of
https://github.com/edcommonwealth/Dashboard.git
synced 2026-03-14 09:15:54 -07:00
chore: show all disaggregations without error on analyze page
This commit is contained in:
parent
25e1a940b3
commit
8a8bd4846c
7 changed files with 20 additions and 17 deletions
|
|
@ -1,8 +1,9 @@
|
|||
module Dashboard
|
||||
class Race < ApplicationRecord
|
||||
include FriendlyId
|
||||
has_and_belongs_to_many :students, join_table: :dashboard_student_races, class_name: "Student",
|
||||
foreign_key: :dashboard_student_id, association_foreign_key: :dashboard_student_id
|
||||
|
||||
has_many :student_races, class_name: "StudentRace", foreign_key: :dashboard_race_id
|
||||
has_many :students, through: :student_races, foreign_key: :dashboard_student_id
|
||||
|
||||
friendly_id :designation, use: [:slugged]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
module Dashboard
|
||||
class Student < ApplicationRecord
|
||||
# has_many :dashboard_survey_item_responses
|
||||
has_and_belongs_to_many :races, join_table: :dashboard_student_races, class_name: "Race",
|
||||
foreign_key: :dashboard_race_id, association_foreign_key: :dashboard_race_id
|
||||
has_many :student_races, class_name: "StudentRace", foreign_key: :dashboard_student_id
|
||||
has_many :races, through: :student_races, foreign_key: :dashboard_race_id
|
||||
|
||||
encrypts :lasid, deterministic: true
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
module Dashboard
|
||||
class StudentRace < ApplicationRecord
|
||||
belongs_to :dashboard_student
|
||||
belongs_to :dashboard_race
|
||||
belongs_to :student, optional: true, class_name: "Student", foreign_key: :dashboard_student_id
|
||||
belongs_to :race, optional: true, class_name: "Race", foreign_key: :dashboard_race_id
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -46,9 +46,9 @@ module Dashboard
|
|||
}
|
||||
|
||||
scope :averages_for_race, lambda { |school, academic_year, race|
|
||||
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:, grade: school.grades(academic_year:)
|
||||
).where("student_races.race_id": race.id).group(:survey_item_id).having("count(*) >= 10").average(:likert_score)
|
||||
).where("dashboard_student_races.dashboard_race_id": race.id).group(:dashboard_survey_item_id).having("count(*) >= 10").average(:likert_score)
|
||||
}
|
||||
|
||||
def self.grouped_responses(school:, academic_year:)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue