diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index 5566bf18f..d91ee4882 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -12,6 +12,8 @@ class StatsController < ApplicationController @procedures_count = procedures.count @dossiers_count = dossiers.count + @dossiers_states = dossiers_states + @procedures_cumulative = cumulative_hash(procedures, :published_at) @procedures_in_the_last_4_months = last_four_months_hash(procedures, :published_at) @@ -75,6 +77,15 @@ class StatsController < ApplicationController private + def dossiers_states + { + 'Brouilllon' => Dossier.state_brouillon.count, + 'En construction' => Dossier.state_en_construction.count, + 'En instruction' => Dossier.state_en_instruction.count, + 'Terminé' => Dossier.state_termine.count + } + end + def cloned_from_library_procedures_ratio [3.weeks.ago, 2.weeks.ago, 1.week.ago].map do |date| min_date = date.beginning_of_week diff --git a/app/views/stats/index.html.haml b/app/views/stats/index.html.haml index ace030822..a56f5a0c1 100644 --- a/app/views/stats/index.html.haml +++ b/app/views/stats/index.html.haml @@ -15,6 +15,15 @@ %span.big-number-card-number = number_with_delimiter(@dossiers_count) + .stat-card.stat-card-half.pull-left + %span.stat-card-title + Répartition des dossiers + + .chart-container + .chart + = pie_chart @dossiers_states, + colors: ["rgba(222, 238, 265, 1)", "rgba(191, 220, 249, 1)", "rgba(113, 176, 239, 1)", "rgba(61, 149, 236, 1)"] + .stat-card.stat-card-half.pull-left %ul.segmented-control.pull-right %li.segmented-control-item.segmented-control-item-active{ :onclick => "DS.toggleChart(event, '.monthly-procedures-chart');" }