Use dossier_legacy_state helper

This commit is contained in:
Paul Chavard 2018-11-06 18:46:17 +01:00
parent 0fe59a7c65
commit eede94a59f
3 changed files with 7 additions and 16 deletions

View file

@ -44,7 +44,7 @@ class DossierSerializer < ActiveModel::Serializer
end
def state
object.old_state_value
dossier_legacy_state(object)
end
def simplified_state

View file

@ -1,4 +1,6 @@
class DossierTableExportSerializer < ActiveModel::Serializer
include DossierHelper
attributes :id,
:created_at,
:updated_at,
@ -22,20 +24,7 @@ class DossierTableExportSerializer < ActiveModel::Serializer
end
def state
case object.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
object.state
end
dossier_legacy_state(object)
end
def initiated_at

View file

@ -1,4 +1,6 @@
class DossiersSerializer < ActiveModel::Serializer
include DossierHelper
attributes :id,
:updated_at,
:initiated_at,
@ -13,6 +15,6 @@ class DossiersSerializer < ActiveModel::Serializer
end
def state
object.old_state_value
dossier_legacy_state(object)
end
end