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

@ -1,16 +0,0 @@
@import "colors";
@import "constants";
#user-satisfaction {
text-align: center;
padding: 20px;
.icon {
padding: 10px 5px;
margin: 10px 10px;
&:hover {
cursor: pointer;
}
}
}

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

View file

@ -1,21 +0,0 @@
# == Schema Information
#
# Table name: feedbacks
#
# id :bigint not null, primary key
# rating :string not null
# created_at :datetime not null
# updated_at :datetime not null
# user_id :bigint
#
class Feedback < ApplicationRecord
belongs_to :user, optional: false
enum rating: {
happy: 'happy',
neutral: 'neutral',
unhappy: 'unhappy'
}
validates :rating, presence: true
end

View file

@ -44,7 +44,6 @@ class User < ApplicationRecord
has_many :dossiers, dependent: :destroy
has_many :invites, dependent: :destroy
has_many :dossiers_invites, through: :invites, source: :dossier
has_many :feedbacks, dependent: :destroy
has_many :deleted_dossiers
has_one :france_connect_information, dependent: :destroy
belongs_to :instructeur, optional: true

View file

@ -24,19 +24,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
Satisfaction usager
.chart-container
.chart
= area_chart @satisfaction_usagers,
stacked: true,
suffix: ' %',
max: 100,
library: { plotOptions: { series: { marker: { enabled: true }}}},
colors: ["#C31C25", "#F5962A", "#25B177"]
.stat-card.stat-card-half.pull-left
%span.stat-card-title
Pourcentage de contact utilisateur

View file

@ -23,17 +23,6 @@
= paginate(deleted_dossiers)
- if current_user.feedbacks.empty? || current_user.feedbacks.last.created_at < 1.month.ago
#user-satisfaction
%h3 Que pensez-vous de la facilité d'utilisation de ce service ?
.icons
= link_to feedback_path(rating: Feedback.ratings.fetch(:unhappy)), data: { remote: true, method: :post } do
%span.icon.frown
= link_to feedback_path(rating: Feedback.ratings.fetch(:neutral)), data: { remote: true, method: :post } do
%span.icon.meh
= link_to feedback_path(rating: Feedback.ratings.fetch(:happy)), data: { remote: true, method: :post } do
%span.icon.smile
- else
.blank-tab
%h2.empty-text Aucun dossier.

View file

@ -31,17 +31,6 @@
= paginate(dossiers)
- if current_user.feedbacks.empty? || current_user.feedbacks.last.created_at < 1.month.ago
#user-satisfaction
%h3 Que pensez-vous de la facilité d'utilisation de ce service ?
.icons
= link_to feedback_path(rating: Feedback.ratings.fetch(:unhappy)), data: { remote: true, method: :post } do
%span.icon.frown
= link_to feedback_path(rating: Feedback.ratings.fetch(:neutral)), data: { remote: true, method: :post } do
%span.icon.meh
= link_to feedback_path(rating: Feedback.ratings.fetch(:happy)), data: { remote: true, method: :post } do
%span.icon.smile
- else
.blank-tab
%h2.empty-text Aucun dossier.

View file

@ -1,7 +0,0 @@
try {
window.scroll({ top: 0, left: 0, behavior: 'smooth' });
} catch(e) {
window.scroll(0, 0);
}
<%= remove_element('#user-satisfaction') %>
<%= render_flash %>