Skip to content

Commit

Permalink
Merge pull request #137 from etalab/remove_deprecated_pivot_identity_…
Browse files Browse the repository at this point in the history
…fields

Remove deprecated pivot identity fields
  • Loading branch information
JeSuisUnCaillou authored Oct 14, 2024
2 parents 49cc173 + 1a8d5ed commit 8603209
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
2 changes: 1 addition & 1 deletion app/jobs/populate_hubee_sandbox_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def perform(*args)
private

def pivot_identity
PivotIdentity.new(first_names: ["David"], last_name: "Heinemeier Hansson", birth_country: "99135", birthplace: nil, birthdate: Date.new(1979, 10, 15), gender: :male)
PivotIdentity.new(**FranceConnect::IdentityMapper.normalize(original_pivot_identity))
end

def original_pivot_identity
Expand Down
14 changes: 2 additions & 12 deletions app/models/shipment_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,8 @@ def initialize(pivot_identity:, original_pivot_identity:, quotient_familial:, ex
def to_h
{
external_id: external_id,
pivot_identity: {
codePaysLieuDeNaissance: pivot_identity.birth_country,
anneeDateDeNaissance: pivot_identity.birthdate.year,
moisDateDeNaissance: pivot_identity.birthdate.month,
jourDateDeNaissance: pivot_identity.birthdate.day,
codeInseeLieuDeNaissance: pivot_identity.birthplace,
prenoms: pivot_identity.first_names,
sexe: (pivot_identity.gender == :female) ? "F" : "M",
nomUsuel: pivot_identity.last_name,
**original_pivot_identity,
},
quotient_familial:,
pivot_identity: original_pivot_identity,
quotient_familial: quotient_familial,
}
end

Expand Down
8 changes: 0 additions & 8 deletions spec/models/shipment_data_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@
{
external_id: "external_id",
pivot_identity: {
codePaysLieuDeNaissance: "99135",
anneeDateDeNaissance: 1979,
moisDateDeNaissance: 10,
jourDateDeNaissance: 15,
codeInseeLieuDeNaissance: nil,
prenoms: ["David"],
sexe: "M",
nomUsuel: "Heinemeier Hansson",
family_name: "TESTMAN",
given_name: "Johnny Paul René",
gender: "male",
Expand Down

0 comments on commit 8603209

Please sign in to comment.