Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ajout de la restriction sur les potentiels doublons hors meme departement #478

Merged
merged 4 commits into from
Oct 15, 2024

Conversation

jbouhadoun
Copy link
Member

No description provided.

@jbouhadoun jbouhadoun linked an issue Oct 11, 2024 that may be closed by this pull request
@jbouhadoun jbouhadoun self-assigned this Oct 11, 2024
@jbouhadoun jbouhadoun requested a review from nkokla October 11, 2024 11:14
@jbouhadoun jbouhadoun changed the title Ajout de la restriction sur les potentiels doublons hors meme departemen Ajout de la restriction sur les potentiels doublons hors meme departement Oct 11, 2024
lib/api/address/utils.js Show resolved Hide resolved
@jbouhadoun jbouhadoun merged commit 0872fe6 into master Oct 15, 2024
1 check passed
const existingCog = await getCogFromDistrictID(existingAddresseDistrictID)
// Departement check

const sliceLength = getDepartmentSliceLength(districtID)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const sliceLength = getDepartmentSliceLength(districtID)
const sliceLength = getDepartmentSliceLength(existingCog)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ou

Suggested change
const sliceLength = getDepartmentSliceLength(districtID)
const sliceLength = getDepartmentSliceLength(currentCog)

ce qui permet de le sortir de la boucle

Comment on lines +111 to +113
const sliceLength = getDepartmentSliceLength(districtID)

if (currentCog.slice(0, sliceLength) !== existingCog.slice(0, sliceLength)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

préférer un getDepartmentCode(cog), peut être plus parlant (faire le slice dedans)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

une fonction semblable existe dans lib/util/cog.cjs getCodeDepartement. Mais on ne veut peut être pas cette dépendance ici.

@@ -196,6 +198,7 @@ describe('getDeltaReport', () => {
idsToCreate: [],
idsToUpdate: [bddAddressMock[0].id],
idsToDelete: [],
idsUnauthorized: []
})
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Serait bien de rajouter un test idsUnauthorized, pour pour ce cas hors departement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Terminé
Development

Successfully merging this pull request may close these issues.

Restriction sur l'ajout des BALs afin d'éviter les doublons
3 participants