Dossier: delete state_nouveaux which is similar to en_construction

This commit is contained in:
Simon Lehericey 2017-12-05 16:03:33 +01:00 committed by LeSim
parent 7cc69de543
commit 4be6cb9126
3 changed files with 4 additions and 5 deletions

View file

@ -22,11 +22,11 @@ class DossiersListFacades
end end
def total_new_dossier def total_new_dossier
current_devise_profil.dossiers.state_nouveaux.not_archived.count current_devise_profil.dossiers.state_en_construction.not_archived.count
end end
def new_dossier_number procedure_id def new_dossier_number procedure_id
current_devise_profil.dossiers.state_nouveaux.not_archived.where(procedure_id: procedure_id).count current_devise_profil.dossiers.state_en_construction.not_archived.where(procedure_id: procedure_id).count
end end
def gestionnaire_procedures_name_and_id_list def gestionnaire_procedures_name_and_id_list

View file

@ -4,7 +4,7 @@ class AutoReceiveDossiersForProcedureJob < ApplicationJob
def perform(procedure_id, state) def perform(procedure_id, state)
procedure = Procedure.find_by(id: procedure_id) procedure = Procedure.find_by(id: procedure_id)
if procedure if procedure
procedure.dossiers.state_nouveaux.update_all(state: state, en_instruction_at: Time.now) procedure.dossiers.state_en_construction.update_all(state: state, en_instruction_at: Time.now)
end end
end end
end end

View file

@ -39,7 +39,6 @@ class Dossier < ActiveRecord::Base
default_scope { where(hidden_at: nil) } default_scope { where(hidden_at: nil) }
scope :state_brouillon, -> { where(state: 'brouillon') } scope :state_brouillon, -> { where(state: 'brouillon') }
scope :state_not_brouillon, -> { where.not(state: 'brouillon') } scope :state_not_brouillon, -> { where.not(state: 'brouillon') }
scope :state_nouveaux, -> { where(state: 'en_construction') }
scope :state_en_construction, -> { where(state: 'en_construction') } scope :state_en_construction, -> { where(state: 'en_construction') }
scope :state_en_instruction, -> { where(state: 'en_instruction') } scope :state_en_instruction, -> { where(state: 'en_instruction') }
scope :state_en_construction_ou_instruction, -> { where(state: EN_CONSTRUCTION_OU_INSTRUCTION) } scope :state_en_construction_ou_instruction, -> { where(state: EN_CONSTRUCTION_OU_INSTRUCTION) }
@ -51,7 +50,7 @@ class Dossier < ActiveRecord::Base
scope :order_by_updated_at, -> (order = :desc) { order(updated_at: order) } scope :order_by_updated_at, -> (order = :desc) { order(updated_at: order) }
scope :all_state, -> { not_archived.state_not_brouillon } scope :all_state, -> { not_archived.state_not_brouillon }
scope :nouveaux, -> { not_archived.state_nouveaux } scope :nouveaux, -> { not_archived.state_en_construction }
scope :en_instruction, -> { not_archived.state_en_instruction } scope :en_instruction, -> { not_archived.state_en_instruction }
scope :termine, -> { not_archived.state_termine } scope :termine, -> { not_archived.state_termine }
scope :downloadable_sorted, -> { state_not_brouillon.includes(:entreprise, :etablissement, :champs, :champs_private).order(en_construction_at: 'asc') } scope :downloadable_sorted, -> { state_not_brouillon.includes(:entreprise, :etablissement, :champs, :champs_private).order(en_construction_at: 'asc') }