Remove unused service

This commit is contained in:
Mathieu Magnin 2017-04-20 10:55:54 +02:00
parent 1a628dc42c
commit 21a2a5402b
4 changed files with 3 additions and 61 deletions

View file

@ -10,7 +10,7 @@ class Users::DossiersController < UsersController
end
def index
set_liste
@liste ||= params[:liste] || 'a_traiter'
@user_dossiers = current_user.dossiers
@ -232,8 +232,4 @@ class Users::DossiersController < UsersController
def facade id = params[:id]
DossierFacades.new id, current_user.email
end
def set_liste
@liste ||= params[:liste] || 'a_traiter'
end
end

View file

@ -10,11 +10,7 @@ class DossiersListFacades
end
def service
if gestionnaire?
@service ||= DossiersListGestionnaireService.new @current_devise_profil, @liste, @procedure
elsif user?
@service ||= DossiersListUserService.new @current_devise_profil, @liste
end
end
def total_dossier
@ -81,14 +77,6 @@ class DossiersListFacades
private
def gestionnaire?
@current_devise_profil.class == Gestionnaire
end
def user?
@current_devise_profil.class == User
end
def base_url liste
@procedure.nil? ? backoffice_dossiers_path(liste: liste) : backoffice_dossiers_procedure_path(id: @procedure.id, liste: liste)
end

View file

@ -200,6 +200,7 @@ class Dossier < ActiveRecord::Base
end
scope :archived, -> { where(archived: true) }
scope :not_archived, -> { where(archived: false) }
scope :downloadable, -> { all_state }

View file

@ -1,43 +0,0 @@
class DossiersListUserService
def initialize current_devise_profil, liste
@current_devise_profil = current_devise_profil
@liste = liste
end
def dossiers_to_display
{'brouillon' => brouillon,
'a_traiter' => en_construction,
'en_instruction' => en_instruction,
'termine' => termine,
'invite' => invite,
'all_state' => all_state}[@liste]
end
def self.dossiers_liste_libelle
['brouillon', 'a_traiter', 'en_instruction', 'termine', 'invite', 'all_state']
end
def all_state
@all_state ||= @current_devise_profil.dossiers.all_state
end
def brouillon
@brouillon ||= @current_devise_profil.dossiers.brouillon
end
def en_construction
@en_construction ||= @current_devise_profil.dossiers.en_construction
end
def invite
@invite ||= @current_devise_profil.invites
end
def en_instruction
@en_instruction ||= @current_devise_profil.dossiers.en_instruction
end
def termine
@termine ||= @current_devise_profil.dossiers.termine
end
end