Merge branch 'dev'

This commit is contained in:
gregoirenovel 2018-08-28 11:03:20 +02:00
commit 65a0013e41
13 changed files with 27 additions and 88 deletions

View file

@ -89,9 +89,9 @@ class StatsController < ApplicationController
def satisfaction_usagers
legend = {
Feedback.ratings.fetch(:unhappy) => "Mécontents",
Feedback.ratings.fetch(:happy) => "Satisfaits",
Feedback.ratings.fetch(:neutral) => "Neutres",
Feedback.ratings.fetch(:happy) => "Satisfaits"
Feedback.ratings.fetch(:unhappy) => "Mécontents"
}
totals = Feedback.where(created_at: 5.weeks.ago..Time.now).group_by_week(:created_at).count

View file

@ -45,7 +45,7 @@ class ApiEntreprise::API
end
def self.url(resource_name, siret_or_siren)
[base_url, resource_name, siret_or_siren].join("/")
[API_ENTREPRISE_URL, resource_name, siret_or_siren].join("/")
end
def self.params(siret_or_siren, procedure_id)
@ -62,8 +62,4 @@ class ApiEntreprise::API
def self.token
Rails.application.secrets.api_entreprise[:key]
end
def self.base_url
Rails.application.secrets.api_entreprise[:base_url]
end
end

View file

@ -6,4 +6,6 @@ class Feedback < ApplicationRecord
neutral: 'neutral',
unhappy: 'unhappy'
}
validates :rating, presence: true
end

View file

@ -18,14 +18,6 @@
.container
- if @dossiers.present?
- if @dossiers.total_pages >= 2
.card.feedback
.card-title Nous avons redesigné la liste des dossiers.
%p
Une suggestion pour améliorer cette page&nbsp;? Votre avis nous intéresse&nbsp;! Écrivez-nous à
= mail_to CONTACT_EMAIL, CONTACT_EMAIL, subject: "Amélioration de la liste des dossiers"
\.
%table.table.dossiers-table.hoverable
%thead
%tr

View file

@ -22,7 +22,7 @@
.chart-container
.chart
= line_chart @satisfaction_usagers,
colors: ["#F28900", "rgba(161, 0, 5, 0.9)", "#15AD70"]
colors: ["#15AD70", "#F28900", "rgba(161, 0, 5, 0.9)"]
.stat-card.stat-card-half.pull-left
%span.stat-card-title

View file

@ -6,8 +6,7 @@ GITHUB_CLIENT_SECRET=""
FC_PARTICULIER_ID=""
FC_PARTICULIER_SECRET=""
FC_PARTICULIER_REDIRECT_URI=""
FC_PARTICULIER_HOST=""
FC_PARTICULIER_BASE_URL=""
API_ENTREPRISE_KEY=""
API_ENTREPRISE_BASE_URL="https://entreprise.api.gouv.fr/v2"

View file

@ -1,12 +1,12 @@
# API URLs
API_CARTO_URL = "https://apicarto.sgmap.fr"
API_ENTREPRISE_URL = "https://entreprise.api.gouv.fr/v2"
API_GEO_URL = "https://geo.api.gouv.fr"
PIPEDRIVE_API_URL = 'https://api.pipedrive.com/v1'
# External services URLs
DOC_URL = "https://doc.demarches-simplifiees.fr"
LISTE_DES_DEMARCHES_URL = [DOC_URL, "listes-des-demarches"].join("/")
CGU_URL = [DOC_URL, "cgu"].join("/")
MENTIONS_LEGALES_URL = [CGU_URL, "4-mentions-legales"].join("#")
FAQ_URL = "https://faq.demarches-simplifiees.fr"

View file

@ -18,11 +18,11 @@ defaults: &defaults
france_connect_particulier:
identifier: <%= ENV['FC_PARTICULIER_ID'] %>
secret: <%= ENV['FC_PARTICULIER_SECRET'] %>
redirect_uri: <%= ENV['FC_PARTICULIER_REDIRECT_URI'] %>
authorization_endpoint: <%= ENV['FC_PARTICULIER_HOST'] %>/api/v1/authorize
token_endpoint: <%= ENV['FC_PARTICULIER_HOST'] %>/api/v1/token
userinfo_endpoint: <%= ENV['FC_PARTICULIER_HOST'] %>/api/v1/userinfo
logout_endpoint: <%= ENV['FC_PARTICULIER_HOST'] %>/api/v1/logout
redirect_uri: https://{{ <%= ENV['APP_HOST'] %> }}/france_connect/particulier/callback
authorization_endpoint: <%= ENV['FC_PARTICULIER_BASE_URL'] %>/api/v1/authorize
token_endpoint: <%= ENV['FC_PARTICULIER_BASE_URL'] %>/api/v1/token
userinfo_endpoint: <%= ENV['FC_PARTICULIER_BASE_URL'] %>/api/v1/userinfo
logout_endpoint: <%= ENV['FC_PARTICULIER_BASE_URL'] %>/api/v1/logout
github:
client_id: <%= ENV['GITHUB_CLIENT_ID'] %>
client_secret: <%= ENV['GITHUB_CLIENT_SECRET'] %>
@ -31,7 +31,6 @@ defaults: &defaults
secret_key: <%= ENV['MAILJET_SECRET_KEY'] %>
api_entreprise:
key: <%= ENV['API_ENTREPRISE_KEY'] %>
base_url: <%= ENV['API_ENTREPRISE_BASE_URL'] %>
pipedrive:
key: <%= ENV['PIPEDRIVE_KEY'] %>
fog:
@ -57,7 +56,6 @@ test:
signing_key: aef3153a9829fa4ba10acb02927ac855df6b92795b1ad265d654443c4b14a017
api_entreprise:
key: api_entreprise_test_key
base_url: https://entreprise.api.gouv.fr/v2
fog:
base_url: https://storage.apientreprise.fr
directory: tps_dev

View file

@ -0,0 +1,5 @@
class MakeFeedbacksRatingNotNull < ActiveRecord::Migration[5.2]
def change
change_column_null :feedbacks, :rating, false
end
end

View file

@ -0,0 +1,5 @@
class RemoveMarkOnFeedbacks < ActiveRecord::Migration[5.2]
def change
remove_column :feedbacks, :mark
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2018_08_27_102828) do
ActiveRecord::Schema.define(version: 2018_08_27_111451) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -320,10 +320,9 @@ ActiveRecord::Schema.define(version: 2018_08_27_102828) do
create_table "feedbacks", force: :cascade do |t|
t.bigint "user_id"
t.integer "mark"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "rating"
t.string "rating", null: false
t.index ["user_id"], name: "index_feedbacks_on_user_id"
end

View file

@ -1,56 +1,4 @@
namespace :dev do
desc 'Initialise dev environment'
task :init do
puts 'start initialisation'
Rake::Task['dev:generate_franceconnect_file'].invoke
Rake::Task['dev:generate_fog_credentials_file'].invoke
Rake::Task['dev:generate_features_file'].invoke
puts 'end initialisation'
end
task :generate_franceconnect_file do
file = File.new('config/france_connect.yml', 'w+')
comment = <<~EOF
particulier_identifier: plop
particulier_secret: plip
particulier_redirect_uri: 'http://localhost:3000/france_connect/particulier/callback'
particulier_authorization_endpoint: 'https://fcp.integ01.dev-franceconnect.fr/api/v1/authorize'
particulier_token_endpoint: 'https://fcp.integ01.dev-franceconnect.fr/api/v1/token'
particulier_userinfo_endpoint: 'https://fcp.integ01.dev-franceconnect.fr/api/v1/userinfo'
particulier_logout_endpoint: 'https://fcp.integ01.dev-franceconnect.fr/api/v1/logout'
EOF
file.write(comment)
file.close
end
task :generate_fog_credentials_file do
puts 'creating fog_credentials.test.yml file'
content = <<~EOF
default:
openstack_tenant: "ovh_fake_tenant_name"
openstack_api_key: "ovh_fake_password"
openstack_username: "ovh_fake_username"
openstack_auth_url: "https://auth.cloud.ovh.net/v2.0/tokens"
openstack_region: "SBG1"
EOF
file = File.new("config/fog_credentials.test.yml", "w+")
file.write(content)
file.close
end
task :generate_features_file do
puts 'creating features.yml file'
content = <<~EOF
remote_storage: true
EOF
file = File.new("config/initializers/features.yml", "w+")
file.write(content)
file.close
end
def run_and_stop_if_error(cmd)
sh cmd do |ok, res|
if !ok

View file

@ -59,11 +59,6 @@ describe 'user access to the list of his dossier' do
page.click_link("Suivant")
expect(page).to have_content(dossier_archived.procedure.libelle)
end
scenario 'the user sees a card asking for feedback' do
expect(page).to have_css('.card.feedback')
expect(page).to have_content(CONTACT_EMAIL)
end
end
describe "recherche" do