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 end
def state def state
object.old_state_value dossier_legacy_state(object)
end end
def simplified_state def simplified_state

View file

@ -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

View file

@ -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