demarches-normaliennes/app/controllers/api/statistiques_controller.rb
2017-07-10 16:54:02 +02:00

18 lines
377 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