Merge pull request #2475 from betagouv/improvements

Improvements
This commit is contained in:
gregoirenovel 2018-08-30 13:27:05 +02:00 committed by GitHub
commit ef10a378a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 22 additions and 20 deletions

1
.gitignore vendored
View file

@ -16,7 +16,6 @@ public/uploads
public/downloads
doc/*.svg
uploads/*
.DS_Store
.byebug_history
.env
Procfile.dev

View file

@ -144,4 +144,3 @@ $big-number-card-padding: 2 * $segmented-control-item-border-radius;
text-align: center;
color: $blue;
}

View file

@ -42,14 +42,14 @@ class RootController < ApplicationController
end
type_champ_values = {
TypeDeChamp.type_champs.fetch(:date) => '2016-07-26',
TypeDeChamp.type_champs.fetch(:datetime) => '26/07/2016 07:35',
TypeDeChamp.type_champs.fetch(:textarea) => 'Une description de mon projet'
TypeDeChamp.type_champs.fetch(:date) => '2016-07-26',
TypeDeChamp.type_champs.fetch(:datetime) => '26/07/2016 07:35',
TypeDeChamp.type_champs.fetch(:textarea) => 'Une description de mon projet'
}
type_champ_values.each do |(type_champ, value)|
all_champs
.select { |champ| champ.type_champ == type_champ.to_s }
.select { |champ| champ.type_champ == type_champ }
.each { |champ| champ.value = value }
end

View file

@ -7,7 +7,7 @@ class StatsController < ApplicationController
def index
procedures = Procedure.publiees_ou_archivees
dossiers = Dossier.where.not(:state => Dossier.states.fetch(:brouillon))
dossiers = Dossier.state_not_brouillon
@procedures_numbers = procedures_numbers(procedures)
@dossiers_numbers = dossiers_numbers(dossiers)
@ -198,7 +198,7 @@ class StatsController < ApplicationController
count_per_administrateur = procedures.group(:administrateur_id).count.values
{
'Une procédure' => count_per_administrateur.select { |count| count == 1 }.count,
'Entre deux et cinq procédures' => count_per_administrateur.select { |count| 2 <= count && count <= 5 }.count,
'Entre deux et cinq procédures' => count_per_administrateur.select { |count| count.in?(2..5) }.count,
'Plus de cinq procédures' => count_per_administrateur.select { |count| 5 < count }.count
}
end

View file

@ -59,7 +59,7 @@ class Users::CarteController < UsersController
def self.route_authorization
{
states: [:brouillon, :en_construction],
states: [Dossier.states.fetch(:brouillon), Dossier.states.fetch(:en_construction)],
api_carto: true
}
end

View file

@ -149,7 +149,7 @@ class Users::DossiersController < UsersController
def self.route_authorization
{
states: [:brouillon]
states: [Dossier.states.fetch(:brouillon)]
}
end

View file

@ -18,7 +18,13 @@ class Users::RecapitulatifController < UsersController
def self.route_authorization
{
states: [:en_construction, :en_instruction, :sans_suite, :accepte, :refuse]
states: [
Dossier.states.fetch(:en_construction),
Dossier.states.fetch(:en_instruction),
Dossier.states.fetch(:sans_suite),
Dossier.states.fetch(:accepte),
Dossier.states.fetch(:refuse)
]
}
end

View file

@ -1,7 +1,7 @@
module TypeDeChampHelper
TOGGLES = {
TypeDeChamp.type_champs.fetch(:piece_justificative) => :champ_pj?,
TypeDeChamp.type_champs.fetch(:siret) => :champ_siret?,
TypeDeChamp.type_champs.fetch(:piece_justificative) => :champ_pj?,
TypeDeChamp.type_champs.fetch(:siret) => :champ_siret?,
TypeDeChamp.type_champs.fetch(:linked_drop_down_list) => :champ_linked_dropdown?
}

View file

@ -2,7 +2,7 @@ class UserRoutesAuthorizationService
def self.authorized_route?(controller, dossier)
auth = controller.route_authorization
auth[:states].include?(dossier.state.to_sym) &&
auth[:states].include?(dossier.state) &&
(auth[:api_carto].nil? ? true : auth[:api_carto] == dossier.procedure.use_api_carto)
end
end

View file

@ -3,4 +3,3 @@
= render partial: 'header', locals: { avis: @avis, dossier: @dossier }
= render partial: 'shared/dossiers/show', locals: { dossier: @dossier, demande_seen_at: nil }

View file

@ -124,7 +124,7 @@
partenaires
%li.number
.number-value
= number_with_delimiter(Dossier.where.not(:state => Dossier.states.fetch(:brouillon)).count, :locale => :fr)
= number_with_delimiter(Dossier.state_not_brouillon.count, :locale => :fr)
.number-label<
dossiers
%br<>

View file

@ -50,7 +50,7 @@
partenaires
%li.number
.number-value
= number_with_delimiter(Dossier.where.not(:state => Dossier.states.fetch(:brouillon)).count, :locale => :fr)
= number_with_delimiter(Dossier.state_not_brouillon.count, :locale => :fr)
.number-label<
dossiers
%br<>

View file

@ -3,4 +3,3 @@
- champ_attributes = etablissement.champ.private? ? 'champs_private_attributes' : 'champs_attributes'
= fields_for "dossier[#{champ_attributes}][#{position}][etablissement_attributes]", etablissement do |form|
= form.hidden_field :_destroy

View file

@ -170,7 +170,7 @@ describe StatsController, type: :controller do
}
end
let (:association) { Dossier.where.not(:state => Dossier.states.fetch(:brouillon)) }
let (:association) { Dossier.state_not_brouillon }
subject { StatsController.new.send(:dossier_instruction_mean_time, association) }
@ -222,7 +222,7 @@ describe StatsController, type: :controller do
}
end
let (:association) { Dossier.where.not(:state => Dossier.states.fetch(:brouillon)) }
let (:association) { Dossier.state_not_brouillon }
subject { StatsController.new.send(:dossier_filling_mean_time, association) }