From 0e4b6e1ba237b2edb0a3a01828e14a57a91574b0 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Wed, 6 Mar 2019 17:30:15 +0100 Subject: [PATCH] =?UTF-8?q?Remove=20=E2=80=9CNombre=20d'administrations=20?= =?UTF-8?q?ayant=20d=C3=A9mat=C3=A9rialis=C3=A9=20N=20d=C3=A9marches?= =?UTF-8?q?=E2=80=9D=20graph?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/stats_controller.rb | 11 ------- app/views/stats/index.html.haml | 9 ------ spec/controllers/stats_controller_spec.rb | 36 ----------------------- 3 files changed, 56 deletions(-) diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index b3b77264f..a2c1f0214 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -23,8 +23,6 @@ class StatsController < ApplicationController @dossiers_cumulative = cumulative_hash(dossiers, :en_construction_at) @dossiers_in_the_last_4_months = last_four_months_hash(dossiers, :en_construction_at) - @procedures_count_per_administrateur = procedures_count_per_administrateur(procedures) - if administration_signed_in? @dossier_instruction_mean_time = Rails.cache.fetch("dossier_instruction_mean_time", expires_in: 1.day) do dossier_instruction_mean_time(dossiers) @@ -234,15 +232,6 @@ class StatsController < ApplicationController .reduce({}, :merge) end - def procedures_count_per_administrateur(procedures) - count_per_administrateur = procedures.joins(:administrateurs).group('administrateurs.id').count.values - { - 'Une démarche' => count_per_administrateur.select { |count| count == 1 }.count, - 'Entre deux et cinq démarches' => count_per_administrateur.select { |count| count.in?(2..5) }.count, - 'Plus de cinq démarches' => count_per_administrateur.select { |count| count > 5 }.count - } - end - def mean(collection) (collection.sum.to_f / collection.size).round(2) end diff --git a/app/views/stats/index.html.haml b/app/views/stats/index.html.haml index fc10a6309..c8e9d21ec 100644 --- a/app/views/stats/index.html.haml +++ b/app/views/stats/index.html.haml @@ -84,15 +84,6 @@ .chart.cumulative-dossiers-chart.hidden = area_chart @dossiers_cumulative - .stat-card.stat-card-half.pull-left - %span.stat-card-title - Nombre d'administrations ayant dématérialisé N démarches - - .chart-container - .chart - = pie_chart @procedures_count_per_administrateur, - colors: ["rgba(191, 220, 249, 1)", "rgba(113, 176, 239, 1)", "rgba(61, 149, 236, 1)"] - - if administration_signed_in? .stat-card.stat-card-half.pull-left %span.stat-card-title Temps de traitement moyen d'un dossier diff --git a/spec/controllers/stats_controller_spec.rb b/spec/controllers/stats_controller_spec.rb index 27d9ceb26..ade3ada20 100644 --- a/spec/controllers/stats_controller_spec.rb +++ b/spec/controllers/stats_controller_spec.rb @@ -93,42 +93,6 @@ describe StatsController, type: :controller do end end - describe "#procedures_count_per_administrateur" do - let!(:administrateur_1) { create(:administrateur) } - let!(:administrateur_2) { create(:administrateur) } - let!(:administrateur_3) { create(:administrateur) } - let!(:administrateur_4) { create(:administrateur) } - let!(:administrateur_5) { create(:administrateur) } - - before do - 3.times do - create(:procedure, published_at: Time.zone.now, administrateur: administrateur_1) - end - - 2.times do - create(:procedure, published_at: Time.zone.now, administrateur: administrateur_2) - end - - 8.times do - create(:procedure, published_at: Time.zone.now, administrateur: administrateur_3) - end - - create(:procedure, published_at: Time.zone.now, administrateur: administrateur_4) - end - - let(:association) { Procedure.all } - - subject { StatsController.new.send(:procedures_count_per_administrateur, association) } - - it do - is_expected.to eq({ - 'Une démarche' => 1, - 'Entre deux et cinq démarches' => 2, - 'Plus de cinq démarches' => 1 - }) - end - end - describe "#dossier_instruction_mean_time" do # Month-2: mean 3 days # procedure_1: mean 2 days