Merge pull request #7638 from tchak/fix-stats-page
fix(stats): remove Helpscout from stats page
This commit is contained in:
commit
1402d050cf
2 changed files with 9 additions and 49 deletions
|
@ -16,10 +16,6 @@ class StatsController < ApplicationController
|
|||
stat.dossiers_deposes_entre_60_et_30_jours
|
||||
)
|
||||
|
||||
@contact_percentage = Rails.cache.fetch("stats.contact_percentage", expires_in: 1.day) do
|
||||
contact_percentage
|
||||
end
|
||||
|
||||
@dossiers_states_for_pie = {
|
||||
"Brouillon" => stat.dossiers_brouillon,
|
||||
"En construction" => stat.dossiers_en_construction,
|
||||
|
@ -103,31 +99,6 @@ class StatsController < ApplicationController
|
|||
}
|
||||
end
|
||||
|
||||
def contact_percentage
|
||||
number_of_months = 13
|
||||
|
||||
from = Time.zone.today.prev_month(number_of_months)
|
||||
to = Time.zone.today.prev_month
|
||||
|
||||
adapter = Helpscout::UserConversationsAdapter.new(from, to)
|
||||
if !adapter.can_fetch_reports?
|
||||
return nil
|
||||
end
|
||||
|
||||
adapter
|
||||
.reports
|
||||
.map do |monthly_report|
|
||||
start_date = monthly_report[:start_date].to_time.localtime
|
||||
end_date = monthly_report[:end_date].to_time.localtime
|
||||
replies_count = monthly_report[:replies_sent]
|
||||
|
||||
dossiers_count = Dossier.where(depose_at: start_date..end_date).count
|
||||
|
||||
monthly_contact_percentage = replies_count.fdiv(dossiers_count || 1) * 100
|
||||
[I18n.l(start_date, format: '%b %y'), monthly_contact_percentage.round(1)]
|
||||
end
|
||||
end
|
||||
|
||||
def max_date
|
||||
if super_admin_signed_in?
|
||||
Time.zone.now
|
||||
|
|
|
@ -20,26 +20,6 @@
|
|||
%span.big-number-card-detail
|
||||
#{number_with_delimiter(@dossiers_numbers[:last_30_days_count])} (#{@dossiers_numbers[:evolution]} %) sur les 30 derniers jours
|
||||
|
||||
.stat-card.stat-card-half.pull-left
|
||||
%span.stat-card-title
|
||||
Pourcentage de contact utilisateur
|
||||
|
||||
.chart-container
|
||||
.chart
|
||||
= line_chart @contact_percentage
|
||||
|
||||
.stat-card-details
|
||||
Nombre de réponses envoyées via HelpScout
|
||||
\/ nombre de dossiers déposés
|
||||
|
||||
.stat-card.stat-card-half.pull-left
|
||||
%span.stat-card-title
|
||||
Répartition des dossiers
|
||||
|
||||
.chart-container
|
||||
.chart
|
||||
= pie_chart @dossiers_states_for_pie,
|
||||
colors: ["#000091", "#7F7FC8", "#9A9AFF", "#00006D"]
|
||||
|
||||
.stat-card.stat-card-half.pull-left
|
||||
%ul.segmented-control.pull-right
|
||||
|
@ -71,6 +51,15 @@
|
|||
.chart.cumulative-dossiers-chart.hidden
|
||||
= area_chart @dossiers_cumulative
|
||||
|
||||
.stat-card.stat-card-half.pull-left
|
||||
%span.stat-card-title
|
||||
Répartition des dossiers
|
||||
|
||||
.chart-container
|
||||
.chart
|
||||
= pie_chart @dossiers_states_for_pie,
|
||||
colors: ["#000091", "#7F7FC8", "#9A9AFF", "#00006D"]
|
||||
|
||||
.clearfix
|
||||
|
||||
- if super_admin_signed_in?
|
||||
|
|
Loading…
Reference in a new issue