import students

This commit is contained in:
rebuilt 2022-07-29 15:33:25 -07:00
parent 8c7767d0b9
commit 12e4e3f177
28 changed files with 11093 additions and 10843 deletions

View file

@ -183,10 +183,11 @@ class Measure < ActiveRecord::Base
end
def sufficient_student_data?(school:, academic_year:)
return @sufficient_student_data ||= false unless includes_student_survey_items?
return @sufficient_student_data ||= false if no_student_responses_exist?(school:, academic_year:)
false unless includes_student_survey_items?
false if no_student_responses_exist?(school:, academic_year:)
@sufficient_student_data ||= subcategory.response_rate(school:, academic_year:).meets_student_threshold?
# this gets memoized on first run so check to make sure
subcategory.response_rate(school:, academic_year:).meets_student_threshold?
end
def sufficient_teacher_data?(school:, academic_year:)

View file

@ -1,4 +1,6 @@
class Race < ApplicationRecord
include FriendlyId
has_many :student_races
has_many :students, through: :student_races
friendly_id :designation, use: [:slugged]
end

7
app/models/student.rb Normal file
View file

@ -0,0 +1,7 @@
class Student < ApplicationRecord
has_many :survey_item_responses
has_many :student_races
has_many :races, through: :student_races
encrypts :lasid, deterministic: true
end

View file

@ -0,0 +1,4 @@
class StudentRace < ApplicationRecord
belongs_to :student
belongs_to :race
end

View file

@ -7,6 +7,8 @@ class SurveyItemResponse < ActiveRecord::Base
belongs_to :academic_year
belongs_to :school
belongs_to :survey_item, counter_cache: true
belongs_to :student, foreign_key: :student_id, optional: true
has_one :measure, through: :survey_item
scope :exclude_boston, lambda {