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

Amélioration du système de vérification géographique #4780

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ conditions_generales:
- type: age
operator: ">="
value: 18
- type: epcis
values:
- "200067932"
- type: attached_to_institution
- type: quotient_familial
operator: <=
value: 752
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ conditions_generales:
- type: age
operator: <=
value: 25
- type: epcis
values:
- "200046977"
- type: attached_to_institution
profils:
- type: enseignement_superieur
conditions: []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ description:
Terminale professionnelle.
prefix: la
conditions_generales:
- type: epcis
values:
- "243600327"
- type: attached_to_institution
- type: age
operator: ">="
value: 18
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ description:
heures de conduite.
prefix: l’
conditions_generales:
- type: epcis
values:
- "248300543"
- type: attached_to_institution
profils:
- type: chomeur
conditions: []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ conditions_generales:
- type: age
operator: <=
value: 25
- type: epcis
values:
- "246700488"
- type: attached_to_institution
- type: difficultes_acces_ou_frais_logement
profils: []
conditions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ description:
les académies de Paris, Créteil et Versailles et vivant à Paris.
prefix: l’
conditions_generales:
- type: departements
values:
- "75"
- type: attached_to_institution
profils:
- type: enseignement_superieur
conditions: []
Expand Down
11 changes: 6 additions & 5 deletions tools/test-benefits-geographical-constraint-consistency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ benefits.all
.forEach((benefit) => {
const result = testGeographicalRelevancy(benefit)
if (!result?.isValid) {
console.log(`
console.error(`
================================
Benefit : ${benefit.id}
Benefit slug : ${benefit.slug}
Insee code : ${benefit.institution.code_insee}
potentially incompatible with conditions :
${JSON.stringify(result?.conditions)}`)
Condition type : ${result?.conditions.type}
Benefit institution type : ${benefit.institution.type}`)
}
})

Expand All @@ -34,8 +35,8 @@ function testGeographicalRelevancy(benefit) {
return {
isValid:
conditionGeo.type === "attached_to_institution" ||
(conditionGeo.values.length == 1 &&
conditionGeo.values[0] === benefit.institution.code_insee &&
conditionGeo.values.length > 1 || // Non vérifiable, car une institution peut porter un dispositif applicable à des communes autour
(conditionGeo.values[0] === benefit.institution.code_insee &&
conditionGeo.type.slice(0, -1) === benefit.institution.type),
conditions: conditionGeo,
}
Expand Down
Loading