Add a chart showing the dossiers state repartition

This commit is contained in:
gregoirenovel 2018-08-24 17:10:27 +02:00
parent 9292e243ef
commit f381d45d1a
2 changed files with 20 additions and 0 deletions

View file

@ -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

View file

@ -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');" }