2016-02-29 15:15:44 +01:00
|
|
|
class API::StatistiquesController < ApplicationController
|
|
|
|
def dossiers_stats
|
|
|
|
render json: {
|
2018-01-15 19:02:12 +01:00
|
|
|
total: total_dossiers,
|
|
|
|
mois: dossiers_mois
|
|
|
|
}
|
2016-02-29 15:15:44 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def total_dossiers
|
2017-07-10 16:11:12 +02:00
|
|
|
Dossier.state_not_brouillon.size
|
2016-02-29 15:15:44 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def dossiers_mois
|
2017-07-10 16:11:12 +02:00
|
|
|
Dossier.state_not_brouillon.where(created_at: (1.month.ago)..Time.now).size
|
2016-02-29 15:15:44 +01:00
|
|
|
end
|
|
|
|
end
|