-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat(formation): ajout de la page formation #492
Conversation
9050764
to
89efafc
Compare
d321c47
to
070b585
Compare
4aef47b
to
d3e9bbe
Compare
.vscode/settings.json
Outdated
"compareFolders.respectGitIgnore": true, | ||
"[shellscript]": { | ||
"editor.defaultFormatter": "foxundermoon.shell-format" | ||
}, | ||
"[dotenv]": { | ||
"editor.defaultFormatter": "foxundermoon.shell-format" | ||
}, | ||
"[sql]": { | ||
"editor.defaultFormatter": "inferrinizzard.prettier-sql-vscode" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Peut-être pas nécessaire dans les conf du projet
.where((w) => | ||
w.or([ | ||
w("formationView.dateFermeture", "is", null), | ||
w("formationView.dateFermeture", ">", sql<Date>`${getDateRentreeScolaire(CURRENT_RENTREE)}`), | ||
]) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tu peux ici utiliser notHistoriqueUnlessCoExistant
dans utils/notHistorique.ts
wb | ||
.selectFrom("formations") | ||
.leftJoin("formationHistorique", "formationHistorique.cfd", "formations.cfd") | ||
.where("formations.dateOuverture", "<=", sql<Date>`${getDateRentreeScolaire(CURRENT_RENTREE)}`) | ||
.where("formationHistorique.ancienCFD", "in", (eb) => eb.selectFrom("formationEtablissement").select("cfd")) | ||
.select("formationHistorique.cfd") | ||
.distinct() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pareil tu peux retrouver certainement des fonctions utils dans utils/notHistorique.ts
const [nsf, filters, formations] = await Promise.all([ | ||
deps.getNsf(codeNsf), | ||
deps.getFilters(), | ||
deps.getFormations({ | ||
codeNsf, | ||
codeRegion, | ||
codeDepartement, | ||
codeAcademie, | ||
}), | ||
]); | ||
|
||
if (!nsf) { | ||
throw Boom.notFound(`Le domaine de formation avec le code ${codeNsf} est inconnue`); | ||
} | ||
|
||
return { | ||
codeNsf, | ||
libelleNsf: nsf.libelleNsf, | ||
filters, | ||
formations, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const [nsf, filters, formations] = await Promise.all([ | |
deps.getNsf(codeNsf), | |
deps.getFilters(), | |
deps.getFormations({ | |
codeNsf, | |
codeRegion, | |
codeDepartement, | |
codeAcademie, | |
}), | |
]); | |
if (!nsf) { | |
throw Boom.notFound(`Le domaine de formation avec le code ${codeNsf} est inconnue`); | |
} | |
return { | |
codeNsf, | |
libelleNsf: nsf.libelleNsf, | |
filters, | |
formations, | |
}; | |
const [{libelleNsf}, filters, formations] = await Promise.all([ | |
deps.getNsf(codeNsf), | |
deps.getFilters(), | |
deps.getFormations({ | |
codeNsf, | |
codeRegion, | |
codeDepartement, | |
codeAcademie, | |
}), | |
]); | |
if (!nsf) { | |
throw Boom.notFound(`Le domaine de formation avec le code ${codeNsf} est inconnue`); | |
} | |
return { | |
codeNsf, | |
libelleNsf, | |
filters, | |
formations, | |
}; |
getKbdClient() | ||
.selectFrom("formationView") | ||
.innerJoin("niveauDiplome", "niveauDiplome.codeNiveauDiplome", "formationView.codeNiveauDiplome") | ||
.leftJoin("formationRome", "formationRome.cfd", "formationView.cfd") | ||
.leftJoin("rome", "rome.codeRome", "formationRome.codeRome") | ||
.select((sb) => [ | ||
sb.ref("formationView.cfd").as("cfd"), | ||
sb.ref("niveauDiplome.libelleNiveauDiplome").as("libelleNiveauDiplome"), | ||
sb.ref("formationView.libelleFormation").as("libelleFormation"), | ||
sql<number>`count(distinct ${sb.ref("formationRome.codeRome")})`.as("nb romes total"), | ||
sql<number>`count(distinct case when ${sb.ref( | ||
`rome.${transitionType}` | ||
)} then ${sb.ref("formationRome.codeRome")} end)`.as(`nb romes ${transitionType}`), | ||
]) | ||
.groupBy(["formationView.cfd", "niveauDiplome.libelleNiveauDiplome", "formationView.libelleFormation"]) | ||
.as("sous_requete") | ||
) | ||
.select((sb) => [sb.ref("sous_requete.cfd").as("cfd")]) | ||
.where("sous_requete.cfd", "=", cfd) | ||
.where("nb romes total", ">", 0) | ||
.whereRef("nb romes total", "=", `nb romes ${transitionType}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pourquoi whereRef
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pour pouvoir utiliser le "nb romes ${}"
const formatDispositifs = (dispositifs: string[]) => { | ||
return dispositifs | ||
.filter((libelle) => libelle !== "") | ||
.map((d) => { | ||
return d.replace(/\sen\s/i, " ").replace(/professionnel/i, "PRO"); | ||
}); | ||
}; | ||
const formatSecteur = (secteur: string) => { | ||
switch (secteur) { | ||
case "PU": | ||
return "Public"; | ||
case "PR": | ||
return "Privé"; | ||
default: | ||
return ""; | ||
} | ||
}; | ||
|
||
const formatDepartement = (departement: string) => { | ||
if (departement.length === 3 && departement.startsWith("0")) { | ||
return departement.substring(1); | ||
} | ||
|
||
return departement; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Utilise peut-être les fonctions utiles de formatage ?
ui/app/(wrapped)/domaine-de-formation/[codeNsf]/components/FiltersSection/FiltersSection.tsx
Outdated
Show resolved
Hide resolved
ui/app/(wrapped)/domaine-de-formation/[codeNsf]/components/FiltersSection/FiltersSection.tsx
Outdated
Show resolved
Hide resolved
ui/app/(wrapped)/domaine-de-formation/[codeNsf]/components/FiltersSection/FiltersSection.tsx
Outdated
Show resolved
Hide resolved
includeAll: z | ||
.enum(["true", "false"]) | ||
.transform((val) => val === "true") | ||
.optional() | ||
.default("false"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh beh, qu'est ce qu'il faut pas faire pour passer un boolean dans une requête....
4bfec82
to
c284e59
Compare
sb.ref("nsf.codeNsf").as("nsf"), | ||
sb.val("formation").as("type"), | ||
]) | ||
.where((w) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On devrait se faire un petit utils de search vu qu'on utilise ce style de requête un peu partout
@@ -0,0 +1,78 @@ | |||
import { usePg } from "@tests/pg.test.utils"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
sb.ref("formationView.cfd").as("cfd"), | ||
sb.ref("niveauDiplome.libelleNiveauDiplome").as("libelleNiveauDiplome"), | ||
sb.ref("formationView.libelleFormation").as("libelleFormation"), | ||
sql<number>`count(distinct ${sb.ref("formationRome.codeRome")})`.as("nb romes total"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Peut-être les nommer en camelCase pour rester consistant dans la nomenclature ?
)} then ${sb.ref("formationRome.codeRome")} end)`.as(`nb romes ${transitionType}`), | ||
]) | ||
.groupBy(["formationView.cfd", "niveauDiplome.libelleNiveauDiplome", "formationView.libelleFormation"]) | ||
.as("sous_requete") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Peu-être être plus précis sur le nommage de cette requête ? Elle ramène quoi ?
]) | ||
.$call((qb) => { | ||
if (!codeRegion && !codeDepartement && !codeAcademie) { | ||
qb = qb.where((wb) => wb.and([wb("codeRegion", ">=", "11"), wb("codeRegion", "<=", "93")])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm je veux bien un commentaire ou un utils qui explicite ce que cette condition fait. Ça garde uniquement les régions IJ ? Ou autre chose ?
.selectFrom("maille_etab") | ||
.innerJoin("indicateurEntree", "indicateurEntree.formationEtablissementId", "maille_etab.id") | ||
.where("cfd", "=", cfd) | ||
.where("rentreeScolaire", ">", "2020") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pourquoi 2020 en dur ?
@@ -0,0 +1,55 @@ | |||
import { z } from "zod"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Si on suit la logique de nomanclature, le fichier devrait être nommé : get.domaine-de-formation.codeNsf.schema.ts
const onExportExcel = async () => { | ||
if (!etablissements.length) return; | ||
|
||
trackEvent("domaine-de-formation-etablissements:export-excel"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
T'as bien activé les events sur plausible ?
@@ -0,0 +1,192 @@ | |||
import { usePlausible } from "next-plausible"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm il me semble qu'on fait différemment avec les exports normalement, il y a un fichier type séparé avec les énums et les colonnes qu'on veut sortir. Peut-être garder cette manière de faire ?
} | ||
chartRef.current.setOption(option, true); | ||
chartRef.current.on("legendselectchanged", (params) => { | ||
//@ts-ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rm ?
c284e59
to
4242441
Compare
4242441
to
b551bbb
Compare
🎉 This PR is included in version 0.8.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
No description provided.