Remove dead code related to dossier state
This commit is contained in:
parent
eede94a59f
commit
33c6ddc452
4 changed files with 0 additions and 99 deletions
|
@ -1,6 +1,4 @@
|
||||||
class DossierDecorator < Draper::Decorator
|
class DossierDecorator < Draper::Decorator
|
||||||
include Rails.application.routes.url_helpers
|
|
||||||
|
|
||||||
delegate :current_page, :limit_value, :total_pages
|
delegate :current_page, :limit_value, :total_pages
|
||||||
delegate_all
|
delegate_all
|
||||||
|
|
||||||
|
@ -11,12 +9,4 @@ class DossierDecorator < Draper::Decorator
|
||||||
def last_update
|
def last_update
|
||||||
updated_at.strftime('%d/%m/%Y %H:%M')
|
updated_at.strftime('%d/%m/%Y %H:%M')
|
||||||
end
|
end
|
||||||
|
|
||||||
def display_state
|
|
||||||
DossierDecorator.case_state_fr state
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.case_state_fr(state = self.state)
|
|
||||||
h.t("activerecord.attributes.dossier.state.#{state}")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -245,16 +245,6 @@ class Dossier < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def statut
|
|
||||||
if accepte?
|
|
||||||
'accepté'
|
|
||||||
elsif sans_suite?
|
|
||||||
'classé sans suite'
|
|
||||||
elsif refuse?
|
|
||||||
'refusé'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def user_geometry
|
def user_geometry
|
||||||
if json_latlngs.present?
|
if json_latlngs.present?
|
||||||
UserGeometry.new(json_latlngs)
|
UserGeometry.new(json_latlngs)
|
||||||
|
@ -308,23 +298,6 @@ class Dossier < ApplicationRecord
|
||||||
DossierMailer.notify_deletion_to_user(deleted_dossier, user.email).deliver_later
|
DossierMailer.notify_deletion_to_user(deleted_dossier, user.email).deliver_later
|
||||||
end
|
end
|
||||||
|
|
||||||
def old_state_value
|
|
||||||
case state
|
|
||||||
when Dossier.states.fetch(:en_construction)
|
|
||||||
'initiated'
|
|
||||||
when Dossier.states.fetch(:en_instruction)
|
|
||||||
'received'
|
|
||||||
when Dossier.states.fetch(:accepte)
|
|
||||||
'closed'
|
|
||||||
when Dossier.states.fetch(:refuse)
|
|
||||||
'refused'
|
|
||||||
when Dossier.states.fetch(:sans_suite)
|
|
||||||
'without_continuation'
|
|
||||||
else
|
|
||||||
state
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def update_state_dates
|
def update_state_dates
|
||||||
|
|
|
@ -18,38 +18,4 @@ describe DossierDecorator do
|
||||||
subject { super().last_update }
|
subject { super().last_update }
|
||||||
it { is_expected.to eq('24/12/2015 14:10') }
|
it { is_expected.to eq('24/12/2015 14:10') }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'state_fr' do
|
|
||||||
subject{ super().display_state }
|
|
||||||
|
|
||||||
it 'brouillon is brouillon' do
|
|
||||||
dossier.brouillon!
|
|
||||||
expect(subject).to eq('Brouillon')
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'en_construction is En construction' do
|
|
||||||
dossier.en_construction!
|
|
||||||
expect(subject).to eq('En construction')
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'accepte is traité' do
|
|
||||||
dossier.accepte!
|
|
||||||
expect(subject).to eq('Accepté')
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'en_instruction is reçu' do
|
|
||||||
dossier.en_instruction!
|
|
||||||
expect(subject).to eq('En instruction')
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'sans_suite is traité' do
|
|
||||||
dossier.sans_suite!
|
|
||||||
expect(subject).to eq('Sans suite')
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'refuse is traité' do
|
|
||||||
dossier.refuse!
|
|
||||||
expect(subject).to eq('Refusé')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1000,32 +1000,4 @@ describe Dossier do
|
||||||
it { expect(long_expired_dossier).to be_retention_expired }
|
it { expect(long_expired_dossier).to be_retention_expired }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'old_state_value' do
|
|
||||||
subject { dossier.old_state_value }
|
|
||||||
|
|
||||||
context 'when the dossier is en instruction' do
|
|
||||||
let(:dossier) { create(:dossier, :en_instruction) }
|
|
||||||
|
|
||||||
it { is_expected.to eq('received') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when the dossier is accepte' do
|
|
||||||
let(:dossier) { create(:dossier, state: Dossier.states.fetch(:accepte)) }
|
|
||||||
|
|
||||||
it { is_expected.to eq('closed') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when the dossier is refuse' do
|
|
||||||
let(:dossier) { create(:dossier, state: Dossier.states.fetch(:refuse)) }
|
|
||||||
|
|
||||||
it { is_expected.to eq('refused') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when the dossier is sans_suite' do
|
|
||||||
let(:dossier) { create(:dossier, state: Dossier.states.fetch(:sans_suite)) }
|
|
||||||
|
|
||||||
it { is_expected.to eq('without_continuation') }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue