[#2180] Do not double-expose migrated type PJs as champs in procedure API
This commit is contained in:
parent
082255b489
commit
5f74ae1545
2 changed files with 8 additions and 0 deletions
|
@ -44,6 +44,10 @@ class ProcedureSerializer < ActiveModel::Serializer
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def types_de_champ
|
||||||
|
object.types_de_champ.reject { |c| c.old_pj.present? }
|
||||||
|
end
|
||||||
|
|
||||||
def types_de_piece_justificative
|
def types_de_piece_justificative
|
||||||
ActiveModelSerializers::SerializableResource.new(object.types_de_piece_justificative).serializable_hash +
|
ActiveModelSerializers::SerializableResource.new(object.types_de_piece_justificative).serializable_hash +
|
||||||
PiecesJustificativesService.serialize_types_de_champ_as_type_pj(object)
|
PiecesJustificativesService.serialize_types_de_champ_as_type_pj(object)
|
||||||
|
|
|
@ -41,5 +41,9 @@ describe ProcedureSerializer do
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "is not exposed as a type de champ" do
|
||||||
|
expect(subject[:types_de_champ]).not_to include(a_hash_including(libelle: type_pj.libelle))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue