Merge pull request #386 from sgmap/fix_cache_bug_on_stats_page

Fix cache bug on stats page
This commit is contained in:
Mathieu Magnin 2017-06-01 10:34:50 +02:00 committed by GitHub
commit 2c5721c150
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,24 +57,23 @@
: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
.stat-card.stat-card-half.pull-left
%span.stat-card-title Temps de traitement moyen d'un dossier
.chart-container
.chart
= line_chart @dossier_instruction_mean_time,
:ytitle => "Jours",
:colors => ["rgba(61, 149, 236, 1)"]
.chart-container
.chart
= line_chart @dossier_instruction_mean_time,
:ytitle => "Jours",
:colors => ["rgba(61, 149, 236, 1)"]
.stat-card.stat-card-half.pull-left
%span.stat-card-title Temps de remplissage moyen d'un dossier
.stat-card.stat-card-half.pull-left
%span.stat-card-title Temps de remplissage moyen d'un dossier
.chart-container
.chart
= line_chart @dossier_filling_mean_time,
:ytitle => "Minutes",
:colors => ["rgba(61, 149, 236, 1)"]
.chart-container
.chart
= line_chart @dossier_filling_mean_time,
:ytitle => "Minutes",
:colors => ["rgba(61, 149, 236, 1)"]
.clearfix
@ -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