Merge pull request #2864 from betagouv/faster_stats

StatsController: avoid doing useless query
This commit is contained in:
LeSim 2018-10-18 11:55:29 +02:00 committed by GitHub
commit 4ddb614149
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,22 +23,24 @@ class StatsController < ApplicationController
@procedures_count_per_administrateur = procedures_count_per_administrateur(procedures) @procedures_count_per_administrateur = procedures_count_per_administrateur(procedures)
@dossier_instruction_mean_time = Rails.cache.fetch("dossier_instruction_mean_time", expires_in: 1.day) do if administration_signed_in?
dossier_instruction_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
@avis_answer_percentages = avis_answer_percentages
@motivation_usage_dossier = motivation_usage_dossier
@motivation_usage_procedure = motivation_usage_procedure
@cloned_from_library_procedures_ratio = cloned_from_library_procedures_ratio
end 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
@avis_answer_percentages = avis_answer_percentages
@motivation_usage_dossier = motivation_usage_dossier
@motivation_usage_procedure = motivation_usage_procedure
@cloned_from_library_procedures_ratio = cloned_from_library_procedures_ratio
end end
def download def download