Fix cache bug on stats page

This commit is contained in:
Mathieu Magnin 2017-06-01 09:44:22 +02:00
parent c789b85a2d
commit 705a3f3e1b
2 changed files with 22 additions and 18 deletions

View file

@ -18,8 +18,13 @@ class StatsController < ApplicationController
@procedures_count_per_administrateur = procedures_count_per_administrateur(procedures)
@dossier_instruction_mean_time = dossier_instruction_mean_time(dossiers)
@dossier_filling_mean_time = dossier_filling_mean_time(dossiers)
@dossier_instruction_mean_time = Rails.cache.fetch("dossier_instruction_mean_time", expires_in: 1.day) do
dossier_instruction_mean_time(dossiers)
end
@dossier_filling_mean_time = Rails.cache.fetch("dossier_filling_mean_time", expires_in: 1.day) do
dossier_filling_mean_time(dossiers)
end
@avis_usage = avis_usage
@avis_average_answer_time = avis_average_answer_time

View file

@ -57,7 +57,6 @@
:colors => ["rgba(191, 220, 249, 1)", "rgba(113, 176, 239, 1)", "rgba(61, 149, 236, 1)"]
- if administration_signed_in?
- cache "computation-heavy-stats", :expires_in => 1.day do
.stat-card.stat-card-half.pull-left
%span.stat-card-title Temps de traitement moyen d'un dossier
@ -92,6 +91,6 @@
.stat-card.stat-card-half.pull-left
%span.stat-card-title Pourcentage d'avis rempli
= line_chart @avis_answer_percentages, ytitle: 'avis avec reponse / total avis', xtitle: 'semaines'
= line_chart @avis_answer_percentages, ytitle: 'avis avec réponse / total avis', xtitle: 'semaines'
.clearfix