Remove user feedback buttons

This commit is contained in:
Paul Chavard 2021-04-15 16:24:03 +01:00
parent dc73500d61
commit 2a068fb9b0
12 changed files with 0 additions and 211 deletions

View file

@ -17,8 +17,6 @@ class StatsController < ApplicationController
stat.dossiers_deposes_entre_60_et_30_jours
)
@satisfaction_usagers = satisfaction_usagers
@contact_percentage = contact_percentage
@dossiers_states_for_pie = {
@ -123,42 +121,6 @@ class StatsController < ApplicationController
}
end
def satisfaction_usagers
legend = {
Feedback.ratings.fetch(:unhappy) => "Mécontents",
Feedback.ratings.fetch(:neutral) => "Neutres",
Feedback.ratings.fetch(:happy) => "Satisfaits"
}
number_of_weeks = 12
totals = Feedback
.group_by_week(:created_at, last: number_of_weeks, current: false)
.count
legend.keys.map do |rating|
data = Feedback
.where(rating: rating)
.group_by_week(:created_at, last: number_of_weeks, current: false)
.count
.map do |week, count|
total = totals[week]
# By default a week is displayed by the first day of the week but we'd rather display the last day
label = week.next_week
if total > 0
[label, (count.to_f / total * 100).round(2)]
else
[label, 0]
end
end.to_h
{
name: legend[rating],
data: data
}
end
end
def contact_percentage
number_of_months = 13

View file

@ -1,8 +0,0 @@
module Users
class FeedbacksController < UserController
def create
current_user.feedbacks.create!(rating: params[:rating])
flash.notice = "Merci de votre retour, si vous souhaitez nous en dire plus, n'hésitez pas à #{helpers.contact_link('nous contacter', type: Helpscout::FormAdapter::TYPE_AMELIORATION)}."
end
end
end