Use the archived and not_archived Dossier scopes
This commit is contained in:
parent
f480f26bd4
commit
3a602b05a4
3 changed files with 7 additions and 7 deletions
|
@ -12,7 +12,7 @@ class AdminProceduresShowFacades
|
||||||
end
|
end
|
||||||
|
|
||||||
def dossiers_for_pie_highchart
|
def dossiers_for_pie_highchart
|
||||||
dossiers.state_not_brouillon.where.not(archived: true).group(:state).count
|
dossiers.state_not_brouillon.not_archived.group(:state).count
|
||||||
.reduce({}) do |acc, (key, val)|
|
.reduce({}) do |acc, (key, val)|
|
||||||
translated_key = DossierDecorator.case_state_fr(key)
|
translated_key = DossierDecorator.case_state_fr(key)
|
||||||
acc[translated_key].nil? ? acc[translated_key] = val : acc[translated_key] += val
|
acc[translated_key].nil? ? acc[translated_key] = val : acc[translated_key] += val
|
||||||
|
@ -21,11 +21,11 @@ class AdminProceduresShowFacades
|
||||||
end
|
end
|
||||||
|
|
||||||
def dossiers_archived_by_state_total
|
def dossiers_archived_by_state_total
|
||||||
dossiers.select('state, count(*) as total').where(archived: true).where.not(state: :termine).group(:state).order(:state).decorate
|
dossiers.select('state, count(*) as total').archived.where.not(state: :termine).group(:state).order(:state).decorate
|
||||||
end
|
end
|
||||||
|
|
||||||
def dossiers_archived_total
|
def dossiers_archived_total
|
||||||
dossiers.where(archived: true).where.not(state: :termine).size
|
dossiers.archived.where.not(state: :termine).size
|
||||||
end
|
end
|
||||||
|
|
||||||
def dossiers_total
|
def dossiers_total
|
||||||
|
|
|
@ -14,7 +14,7 @@ class DossiersListFacades
|
||||||
end
|
end
|
||||||
|
|
||||||
def total_dossier
|
def total_dossier
|
||||||
current_devise_profil.dossiers.where(archived: false).count
|
current_devise_profil.dossiers.not_archived.count
|
||||||
end
|
end
|
||||||
|
|
||||||
def total_dossier_follow
|
def total_dossier_follow
|
||||||
|
@ -22,11 +22,11 @@ class DossiersListFacades
|
||||||
end
|
end
|
||||||
|
|
||||||
def total_new_dossier
|
def total_new_dossier
|
||||||
current_devise_profil.dossiers.where(state: :initiated, archived: false).count
|
current_devise_profil.dossiers.where(state: :initiated).not_archived.count
|
||||||
end
|
end
|
||||||
|
|
||||||
def new_dossier_number procedure_id
|
def new_dossier_number procedure_id
|
||||||
current_devise_profil.dossiers.where(state: :initiated, archived: false, procedure_id: procedure_id).count
|
current_devise_profil.dossiers.where(state: :initiated).not_archived.where(procedure_id: procedure_id).count
|
||||||
end
|
end
|
||||||
|
|
||||||
def gestionnaire_procedures_name_and_id_list
|
def gestionnaire_procedures_name_and_id_list
|
||||||
|
|
|
@ -46,7 +46,7 @@ class Search < ActiveRecord::Base
|
||||||
|
|
||||||
dossier_ids = @gestionnaire.dossiers
|
dossier_ids = @gestionnaire.dossiers
|
||||||
.select(:id)
|
.select(:id)
|
||||||
.where(archived: false)
|
.not_archived
|
||||||
.state_not_brouillon
|
.state_not_brouillon
|
||||||
|
|
||||||
q = Search
|
q = Search
|
||||||
|
|
Loading…
Add table
Reference in a new issue