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
|
end
|
||||||
|
|
||||||
def state
|
def state
|
||||||
object.old_state_value
|
dossier_legacy_state(object)
|
||||||
end
|
end
|
||||||
|
|
||||||
def simplified_state
|
def simplified_state
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
class DossierTableExportSerializer < ActiveModel::Serializer
|
class DossierTableExportSerializer < ActiveModel::Serializer
|
||||||
|
include DossierHelper
|
||||||
|
|
||||||
attributes :id,
|
attributes :id,
|
||||||
:created_at,
|
:created_at,
|
||||||
:updated_at,
|
:updated_at,
|
||||||
|
@ -22,20 +24,7 @@ class DossierTableExportSerializer < ActiveModel::Serializer
|
||||||
end
|
end
|
||||||
|
|
||||||
def state
|
def state
|
||||||
case object.state
|
dossier_legacy_state(object)
|
||||||
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
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def initiated_at
|
def initiated_at
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
class DossiersSerializer < ActiveModel::Serializer
|
class DossiersSerializer < ActiveModel::Serializer
|
||||||
|
include DossierHelper
|
||||||
|
|
||||||
attributes :id,
|
attributes :id,
|
||||||
:updated_at,
|
:updated_at,
|
||||||
:initiated_at,
|
:initiated_at,
|
||||||
|
@ -13,6 +15,6 @@ class DossiersSerializer < ActiveModel::Serializer
|
||||||
end
|
end
|
||||||
|
|
||||||
def state
|
def state
|
||||||
object.old_state_value
|
dossier_legacy_state(object)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue