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 public/downloads
doc/*.svg doc/*.svg
uploads/* uploads/*
.DS_Store
.byebug_history .byebug_history
.env .env
Procfile.dev Procfile.dev

View file

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

View file

@ -49,7 +49,7 @@ class RootController < ApplicationController
type_champ_values.each do |(type_champ, value)| type_champ_values.each do |(type_champ, value)|
all_champs all_champs
.select { |champ| champ.type_champ == type_champ.to_s } .select { |champ| champ.type_champ == type_champ }
.each { |champ| champ.value = value } .each { |champ| champ.value = value }
end end

View file

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

View file

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

View file

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

View file

@ -18,7 +18,13 @@ class Users::RecapitulatifController < UsersController
def self.route_authorization 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 end

View file

@ -2,7 +2,7 @@ class UserRoutesAuthorizationService
def self.authorized_route?(controller, dossier) def self.authorized_route?(controller, dossier)
auth = controller.route_authorization 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) (auth[:api_carto].nil? ? true : auth[:api_carto] == dossier.procedure.use_api_carto)
end end
end end

View file

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

View file

@ -124,7 +124,7 @@
partenaires partenaires
%li.number %li.number
.number-value .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< .number-label<
dossiers dossiers
%br<> %br<>

View file

@ -50,7 +50,7 @@
partenaires partenaires
%li.number %li.number
.number-value .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< .number-label<
dossiers dossiers
%br<> %br<>

View file

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

View file

@ -170,7 +170,7 @@ describe StatsController, type: :controller do
} }
end 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) } subject { StatsController.new.send(:dossier_instruction_mean_time, association) }
@ -222,7 +222,7 @@ describe StatsController, type: :controller do
} }
end 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) } subject { StatsController.new.send(:dossier_filling_mean_time, association) }