Use scopes when possible
This commit is contained in:
parent
47962ef795
commit
e60aa0c37b
4 changed files with 5 additions and 5 deletions
|
@ -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)
|
||||
|
|
|
@ -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<>
|
||||
|
|
|
@ -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<>
|
||||
|
|
|
@ -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) }
|
||||
|
||||
|
|
Loading…
Reference in a new issue