demarches-normaliennes/app/controllers/api/statistiques_controller.rb
2018-01-15 22:33:12 +01:00

18 lines
352 B
Ruby

class API::StatistiquesController < ApplicationController
def dossiers_stats
render json: {
total: total_dossiers,
mois: dossiers_mois
}
end
private
def total_dossiers
Dossier.state_not_brouillon.size
end
def dossiers_mois
Dossier.state_not_brouillon.where(created_at: (1.month.ago)..Time.now).size
end
end