Use dossier_legacy_state helper
This commit is contained in:
parent
0fe59a7c65
commit
eede94a59f
3 changed files with 7 additions and 16 deletions
|
@ -44,7 +44,7 @@ class DossierSerializer < ActiveModel::Serializer
|
|||
end
|
||||
|
||||
def state
|
||||
object.old_state_value
|
||||
dossier_legacy_state(object)
|
||||
end
|
||||
|
||||
def simplified_state
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue