mirror of
https://github.com/edcommonwealth/Dashboard.git
synced 2026-03-07 13:38:12 -08:00
chore: show analyze page gender, ell, sped, grade info without errors
This commit is contained in:
parent
13915c046e
commit
3fed5cab6a
13 changed files with 27 additions and 23 deletions
|
|
@ -28,11 +28,14 @@ module Dashboard
|
|||
|
||||
def analyze_category_link(district:, school:, academic_year:, category:)
|
||||
year = academic_year.range
|
||||
"/districts/#{district.slug}/schools/#{school.slug}/analyze?year=#{year}&academic_years=#{year}&category=#{category.category_id}"
|
||||
district_school_analyze_index_path(district, school,
|
||||
{ year:, academic_years: year, category: category.category_id })
|
||||
end
|
||||
|
||||
def analyze_subcategory_link(district:, school:, academic_year:, category:, subcategory:)
|
||||
"/districts/#{district.slug}/schools/#{school.slug}/analyze?year=#{academic_year.range}&category=#{category.category_id}&subcategory=#{subcategory.subcategory_id}"
|
||||
year = academic_year.range
|
||||
district_school_analyze_index_path(district, school,
|
||||
{ year: academic_year.range, category: category.category_id, subcategory: subcategory.subcategory_id })
|
||||
end
|
||||
|
||||
def colors
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@ module Dashboard
|
|||
belongs_to :school, class_name: "School", foreign_key: :dashboard_school_id
|
||||
belongs_to :survey_item, class_name: "SurveyItem", foreign_key: :dashboard_survey_item_id
|
||||
belongs_to :academic_year, class_name: "AcademicYear", foreign_key: :dashboard_academic_year_id
|
||||
belongs_to :dashboard_student, optional: true
|
||||
belongs_to :dashboard_gender, optional: true
|
||||
belongs_to :dashboard_income, optional: true
|
||||
belongs_to :dashboard_ell, optional: true
|
||||
belongs_to :dashboard_sped, optional: true
|
||||
belongs_to :student, optional: true, class_name: "Student", foreign_key: :dashboard_student_id
|
||||
belongs_to :gender, optional: true, class_name: "Gender", foreign_key: :dashboard_gender_id
|
||||
belongs_to :income, optional: true, class_name: "Income", foreign_key: :dashboard_income_id
|
||||
belongs_to :ell, optional: true, class_name: "Ell", foreign_key: :dashboard_ell_id
|
||||
belongs_to :sped, optional: true, class_name: "Sped", foreign_key: :dashboard_sped_id
|
||||
|
||||
has_one :dashboard_measure, through: :survey_item
|
||||
has_one :measure, through: :survey_item
|
||||
|
||||
validates :likert_score, numericality: { greater_than: 0, less_than_or_equal_to: 5 }
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ module Dashboard
|
|||
end
|
||||
|
||||
def ell
|
||||
::Ell.find_by_slug "ell"
|
||||
Dashboard::Ell.find_by_slug "ell"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ module Dashboard
|
|||
end
|
||||
|
||||
def ell
|
||||
Ell.find_by_slug "not-ell"
|
||||
Dashboard::Ell.find_by_slug "not-ell"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ module Dashboard
|
|||
end
|
||||
|
||||
def ell
|
||||
Ell.find_by_slug "unknown"
|
||||
Dashboard::Ell.find_by_slug "unknown"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ module Dashboard
|
|||
end
|
||||
|
||||
def gender
|
||||
::Gender.find_by_qualtrics_code 1
|
||||
Gender.find_by_qualtrics_code 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ module Dashboard
|
|||
end
|
||||
|
||||
def gender
|
||||
::Gender.find_by_qualtrics_code 2
|
||||
Gender.find_by_qualtrics_code 2
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ module Dashboard
|
|||
end
|
||||
|
||||
def gender
|
||||
::Gender.find_by_qualtrics_code 4
|
||||
Gender.find_by_qualtrics_code 4
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ module Dashboard
|
|||
end
|
||||
|
||||
def gender
|
||||
::Gender.find_by_qualtrics_code 99
|
||||
Gender.find_by_qualtrics_code 99
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ module Dashboard
|
|||
end
|
||||
|
||||
def sped
|
||||
::Sped.find_by_slug "not-special-education"
|
||||
Dashboard::Sped.find_by_slug "not-special-education"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ module Dashboard
|
|||
end
|
||||
|
||||
def sped
|
||||
::Sped.find_by_slug "special-education"
|
||||
Dashboard::Sped.find_by_slug "special-education"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ module Dashboard
|
|||
end
|
||||
|
||||
def sped
|
||||
::Sped.find_by_slug "unknown"
|
||||
Dashboard::Sped.find_by_slug "unknown"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -85,9 +85,10 @@ module Dashboard
|
|||
|
||||
def process_survey_items(row:)
|
||||
student = Student.find_or_create_by(response_id: row.response_id, lasid: row.lasid)
|
||||
# student.races.delete_all
|
||||
# tmp_races = row.races.map { |race| races[race] }
|
||||
# student.races += tmp_races
|
||||
student.races.delete_all
|
||||
tmp_races = row.races.map { |race| races[race] }
|
||||
student.races += tmp_races
|
||||
student.save
|
||||
|
||||
row.survey_items.map do |survey_item|
|
||||
likert_score = row.likert_score(survey_item_id: survey_item.survey_item_id) || next
|
||||
|
|
@ -97,11 +98,11 @@ module Dashboard
|
|||
next
|
||||
end
|
||||
response = row.survey_item_response(survey_item:)
|
||||
build_response(survey_item_response: response, likert_score:, row:, survey_item:, student:)
|
||||
build_response(survey_item_response: response, likert_score:, row:, survey_item:)
|
||||
end.compact
|
||||
end
|
||||
|
||||
def build_response(survey_item_response:, likert_score:, row:, survey_item:, student:)
|
||||
def build_response(survey_item_response:, likert_score:, row:, survey_item:)
|
||||
gender = genders[row.gender]
|
||||
grade = row.grade
|
||||
income = incomes[row.income.parameterize]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue