chore: get overview page to display without errors

main
Nelson Jovel 2 years ago
parent 64b4d599c7
commit 650a91ca62

@ -24,17 +24,15 @@ module Dashboard
end
def student_survey_items_with_sufficient_responses(school:, academic_year:)
# @student_survey_items_with_sufficient_responses ||= SurveyItem.where(id: SurveyItem.joins("inner join dashboard_survey_item_responses on dashboard_survey_item_responses.survey_item_id = dashboard_survey_items.id")
# .student_survey_items
# .where("dashboard_survey_item_responses.school": school,
# "dashboard_survey_item_responses.academic_year": academic_year,
# "dashboard_survey_item_responses.survey_item_id": survey_items.student_survey_items,
# "dashboard_survey_item_responses.grade": school.grades(academic_year:))
# .group("survey_items.id")
# .having("count(*) >= 10")
# .count.keys)
@student_survey_items_with_sufficient_responses ||= student_survey_items
@student_survey_items_with_sufficient_responses ||= SurveyItem.where(id: SurveyItem.joins("inner join dashboard_survey_item_responses on dashboard_survey_item_responses.dashboard_survey_item_id = dashboard_survey_items.id")
.student_survey_items
.where("dashboard_survey_item_responses.dashboard_school_id": school.id,
"dashboard_survey_item_responses.dashboard_academic_year_id": academic_year.id,
"dashboard_survey_item_responses.dashboard_survey_item_id": survey_items.student_survey_items,
"dashboard_survey_item_responses.grade": school.grades(academic_year:))
.group("dashboard_survey_items.id")
.having("count(*) >= 10")
.count.keys)
end
def teacher_scales

@ -1,9 +1,8 @@
module Dashboard
class Score < ApplicationRecord
belongs_to :dashboard_measure
belongs_to :school
belongs_to :dashboard_academic_year
belongs_to :dashboard_race
belongs_to :measure, class_name: "Measure", foreign_key: :dashboard_measure_id
belongs_to :school, class_name: "School", foreign_key: :dashboard_school_id
belongs_to :academic_year, class_name: "AcademicYear", foreign_key: :dashboard_academic_year_id
NIL_SCORE = Score.new(average: nil, meets_teacher_threshold: false, meets_student_threshold: false,
meets_admin_data_threshold: false)

@ -5,7 +5,7 @@ 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
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

@ -80,7 +80,6 @@
<div class="font-size-14">Ideal</div>
</div>
</div>
<%= render partial: "quality_framework_indicators", locals: { category_presenters: @category_presenters } %>
<div class="overall-response-rate-row">
<%= render partial: "response_rate", locals: {response_rate_presenter: @student_response_rate_presenter} %>
@ -92,9 +91,9 @@
<h2 class="sub-header-2 mb-4">Distance From Benchmark</h2>
<%= render partial: "variance_chart", locals: { presenters: @variance_chart_row_presenters } %>
</div>
<% if @district == District.find_by_name("Boston") %>
<% if @district&.name == 'Boston'%>
<%= render partial: 'layouts/boston_modal' %>
<% elsif @has_empty_dataset %>
<%= render partial: 'layouts/empty_dataset_modal' %>
<%= render partial: 'layouts/dashboard/empty_dataset_modal' %>
<% end %>
<% end %>

@ -18,7 +18,7 @@
<%= stylesheet_link_tag 'dashboard/welcome', media: 'all', 'data-turbo-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbo-track': 'reload' %>
<%= render partial: 'layouts/google_analytics', locals: { google_analytics_id: @google_analytics_id } %>
<%= render partial: 'layouts/dashboard/google_analytics', locals: { google_analytics_id: @google_analytics_id } %>
</head>
<body>

Loading…
Cancel
Save