From 0ac160c824b746c3e8e382f7e4e5e1208c86ceb7 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 29 Aug 2018 14:41:17 +0200 Subject: [PATCH] Remove the now useless stats API --- app/controllers/api/statistiques_controller.rb | 18 ------------------ config/routes.rb | 4 ---- spec/controllers/api/statistiques_spec.rb | 11 ----------- 3 files changed, 33 deletions(-) delete mode 100644 app/controllers/api/statistiques_controller.rb delete mode 100644 spec/controllers/api/statistiques_spec.rb diff --git a/app/controllers/api/statistiques_controller.rb b/app/controllers/api/statistiques_controller.rb deleted file mode 100644 index d8c555040..000000000 --- a/app/controllers/api/statistiques_controller.rb +++ /dev/null @@ -1,18 +0,0 @@ -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 diff --git a/config/routes.rb b/config/routes.rb index 52daa11db..78247d329 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -261,10 +261,6 @@ Rails.application.routes.draw do resources :dossiers, only: [:index, :show] end end - - namespace :statistiques do - get 'dossiers' => '/api/statistiques#dossiers_stats' - end end # diff --git a/spec/controllers/api/statistiques_spec.rb b/spec/controllers/api/statistiques_spec.rb deleted file mode 100644 index fa04982ad..000000000 --- a/spec/controllers/api/statistiques_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'spec_helper' - -describe API::StatistiquesController, type: :controller do - describe '#GET dossiers_stats' do - before do - get :dossiers_stats - end - - it { expect(response.status).to eq 200 } - end -end