Skip to content

Commit

Permalink
feat: ajoute les scolarité "maternelle" et "primaire"
Browse files Browse the repository at this point in the history
  • Loading branch information
Shamzic committed Jul 22, 2024
1 parent 1880213 commit a7dad8d
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 8 deletions.
6 changes: 3 additions & 3 deletions backend/lib/teleservices/demarches-simplifiees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ const fsl_var_sources = {
"scolarite",
`enfant_${id}`
)
const scolariteLabel = Scolarite.types.find(
(t) => t.value === scolarite
)?.label
const scolariteLabel =
Scolarite.scolariteTypes.find((s) => s.value === scolarite)?.label ||
Scolarite.scolariteEnfantTypes.find((s) => s.value === scolarite)?.label
return {
champ_Q2hhbXAtMjU1NDk1MQ: date_naissance.slice(0, 10),
champ_Q2hhbXAtMjU1NDk0OQ: prenom,
Expand Down
5 changes: 5 additions & 0 deletions lib/enums/scolarite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ export enum Scolarite {
Lycee = "lycee",
}

export enum ScolariteEnfant {
Maternelle = "maternelle",
Primaire = "primaire",
}

export enum Etudiant {
Cap1 = "cap_1",
Cap2 = "cap_2",
Expand Down
8 changes: 7 additions & 1 deletion lib/properties/individu-properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,13 @@ export default {
? "Où êtes-vous scolarisé ou scolarisée ?"
: `Où sera scolarisé ou scolarisée ${individu._firstName} à la rentrée prochaine ?`
},
items: ScolariteCategories.types,
items: ({ individu }) =>
individu._role == "demandeur"
? ScolariteCategories.scolariteTypes
: [
...ScolariteCategories.scolariteEnfantTypes,
...ScolariteCategories.scolariteTypes,
],
moreInfo:
"Pour les étudiants en classes préparatoires aux grandes écoles, il faut sélectionner « Dans un établissement de l'enseignement supérieur ».",
}),
Expand Down
13 changes: 12 additions & 1 deletion lib/scolarite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import {
GroupeSpecialite,
MentionBaccalaureat,
Scolarite,
ScolariteEnfant,
} from "./enums/scolarite.js"
export default {
types: [
scolariteTypes: [
{
value: Scolarite.College,
label: "Au collège",
Expand All @@ -26,6 +27,16 @@ export default {
label: "Autre",
},
],
scolariteEnfantTypes: [
{
value: ScolariteEnfant.Maternelle,
label: "À la maternelle",
},
{
value: ScolariteEnfant.Primaire,
label: "À l'école primaire",
},
],
mentionsBaccalaureat: [
{
label: "Mention assez bien",
Expand Down
2 changes: 1 addition & 1 deletion lib/state/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ function individuBlockFactory(id, chapter?: ChapterName) {
subject,
datesGenerator(situation.dateDeValeur).today.value
)
return 8 < age && age <= 25
return 2 <= age && age <= 25
},
steps: [r("scolarite")],
},
Expand Down
8 changes: 6 additions & 2 deletions src/views/simulation/enfants.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,13 @@ export default {
},
nationality: Nationality.getNationalityFromCountryCode,
scolarite(value) {
return (
ScolariteCategories.types.find((s) => s.value === value)?.label || "-"
const scolariteType = ScolariteCategories.scolariteTypes.find(
(s) => s.value === value
)
const scolariteEnfantType = ScolariteCategories.scolariteEnfantTypes.find(
(s) => s.value === value
)
return scolariteType?.label || scolariteEnfantType?.label || "-"
},
},
}
Expand Down

0 comments on commit a7dad8d

Please sign in to comment.