diff --git a/app/controllers/analyze_controller.rb b/app/controllers/analyze_controller.rb index ad8ebec6..8e963eb6 100644 --- a/app/controllers/analyze_controller.rb +++ b/app/controllers/analyze_controller.rb @@ -2,7 +2,7 @@ class AnalyzeController < SqmApplicationController before_action :assign_categories, :assign_subcategories, :assign_measures, :assign_academic_years, - :response_rate_timestamp, :races, :selected_races, :graph, :graphs, :background, only: [:index] + :response_rate_timestamp, :races, :selected_races, :graph, :graphs, :background, :race_score_timestamp, only: [:index] def index; end private @@ -80,4 +80,12 @@ class AnalyzeController < SqmApplicationController def background @background ||= BackgroundPresenter.new(num_of_columns: graph.columns.count) end + + def race_score_timestamp + @race_score_timestamp ||= begin + score = RaceScore.where(school: @school, + academic_year: @academic_year).order(updated_at: :DESC).first || Today.new + score.updated_at + end + end end diff --git a/app/views/analyze/index.html.erb b/app/views/analyze/index.html.erb index b8e62aec..0b925622 100644 --- a/app/views/analyze/index.html.erb +++ b/app/views/analyze/index.html.erb @@ -17,7 +17,7 @@ <%= render partial: "data_filters", locals: {district: @district, school: @school, academic_year: @academic_year, category: @category, subcategory: @subcategory} %> - <% cache [@subcategory, @school, @selected_academic_years, @response_rate_timestamp, @graph, @selected_races] do %> + <% cache [@subcategory, @school, @selected_academic_years, @response_rate_timestamp, @graph, @selected_races, @race_score_timestamp] do %>
<% @measures.each do |measure| %>