mirror of
https://github.com/edcommonwealth/Dashboard.git
synced 2026-03-11 00:00:27 -07:00
chore: start adding browse view
This commit is contained in:
parent
a538eb72f2
commit
f71f88a4ac
12 changed files with 296 additions and 87 deletions
|
|
@ -1,8 +1,8 @@
|
|||
module Dashboard
|
||||
class Race < ApplicationRecord
|
||||
include FriendlyId
|
||||
has_many :dashboard_student_races
|
||||
has_many :dashboard_students, through: :student_races
|
||||
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
|
||||
|
||||
friendly_id :designation, use: [:slugged]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
module Dashboard
|
||||
class Student < ApplicationRecord
|
||||
# has_many :dashboard_survey_item_responses
|
||||
has_many :dashboard_student_races
|
||||
has_and_belongs_to_many :races, join_table: :student_races
|
||||
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
|
||||
|
||||
encrypts :lasid, deterministic: true
|
||||
end
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ module Dashboard
|
|||
def self.grouped_responses(school:, academic_year:)
|
||||
@grouped_responses ||= Hash.new do |memo, (school, academic_year)|
|
||||
memo[[school, academic_year]] =
|
||||
SurveyItemResponse.where(school:, academic_year:).group(:survey_item_id).average(:likert_score)
|
||||
SurveyItemResponse.where(school:, academic_year:).group(:dashboard_survey_item_id).average(:likert_score)
|
||||
end
|
||||
@grouped_responses[[school, academic_year]]
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue