Update caching rule so a race_score with an updated timestamp will break the cache

pull/1/head
rebuilt 3 years ago
parent aa159e953f
commit 42e150b33b

@ -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

@ -17,7 +17,7 @@
<%= render partial: "data_filters", locals: {district: @district, school: @school, academic_year: @academic_year, category: @category, subcategory: @subcategory} %>
</div>
<% 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 %>
<div class="bg-color-white flex-grow-1 col-9">
<% @measures.each do |measure| %>
<section class="mb-6">

Loading…
Cancel
Save