diff --git a/app/serializers/dossier_serializer.rb b/app/serializers/dossier_serializer.rb index a6d62e851..1e94ac318 100644 --- a/app/serializers/dossier_serializer.rb +++ b/app/serializers/dossier_serializer.rb @@ -44,7 +44,7 @@ class DossierSerializer < ActiveModel::Serializer end def state - object.old_state_value + dossier_legacy_state(object) end def simplified_state diff --git a/app/serializers/dossier_table_export_serializer.rb b/app/serializers/dossier_table_export_serializer.rb index 6622f3401..cdc125cca 100644 --- a/app/serializers/dossier_table_export_serializer.rb +++ b/app/serializers/dossier_table_export_serializer.rb @@ -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 diff --git a/app/serializers/dossiers_serializer.rb b/app/serializers/dossiers_serializer.rb index 6751e5c53..784236b96 100644 --- a/app/serializers/dossiers_serializer.rb +++ b/app/serializers/dossiers_serializer.rb @@ -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