commit
ef10a378a4
18 changed files with 22 additions and 20 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -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
|
||||||
|
|
|
@ -144,4 +144,3 @@ $big-number-card-padding: 2 * $segmented-control-item-border-radius;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: $blue;
|
color: $blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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 }
|
||||||
|
|
||||||
|
|
|
@ -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<>
|
||||||
|
|
|
@ -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<>
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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) }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue