2015-12-04 16:17:35 +01:00
|
|
|
class AdminProceduresShowFacades
|
2018-03-20 17:47:37 +01:00
|
|
|
def initialize(procedure)
|
2015-12-04 16:17:35 +01:00
|
|
|
@procedure = procedure
|
|
|
|
end
|
|
|
|
|
|
|
|
def procedure
|
|
|
|
@procedure
|
|
|
|
end
|
|
|
|
|
|
|
|
def dossiers
|
2017-07-10 16:11:12 +02:00
|
|
|
@procedure.dossiers.state_not_brouillon
|
2015-12-04 16:17:35 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def dossiers_for_pie_highchart
|
2017-07-10 16:15:09 +02:00
|
|
|
dossiers.state_not_brouillon.not_archived.group(:state).count
|
2017-03-06 18:14:54 +01:00
|
|
|
.reduce({}) do |acc, (key, val)|
|
|
|
|
translated_key = DossierDecorator.case_state_fr(key)
|
|
|
|
acc[translated_key].nil? ? acc[translated_key] = val : acc[translated_key] += val
|
|
|
|
acc
|
|
|
|
end
|
2015-12-04 16:17:35 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def dossiers_archived_by_state_total
|
2017-07-10 16:15:09 +02:00
|
|
|
dossiers.select('state, count(*) as total').archived.where.not(state: :termine).group(:state).order(:state).decorate
|
2015-12-04 16:17:35 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def dossiers_archived_total
|
2017-07-10 16:15:09 +02:00
|
|
|
dossiers.archived.where.not(state: :termine).size
|
2015-12-04 16:17:35 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def dossiers_total
|
|
|
|
dossiers.size
|
|
|
|
end
|
|
|
|
|
|
|
|
def dossiers_termine_total
|
|
|
|
dossiers.where(state: :termine).size
|
|
|
|
end
|
2017-04-04 15:27:04 +02:00
|
|
|
end
|