Skip to content

Commit

Permalink
Merge pull request #533 from mission-apprentissage/fix/export-restitu…
Browse files Browse the repository at this point in the history
…tion

fix: colonnes d'export de la restit et compteurs fcil et CS
  • Loading branch information
gBusato authored Jan 14, 2025
2 parents 8f1c60f + 5884e5c commit b3f398d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export const getDemandesRestitutionIntentionsQuery = async ({
)
.selectAll("demande")
.select((eb) => [
sql<string>`count(*) over()`.as("count"),
"dataFormation.libelleFormation",
"dataFormation.typeFamille",
"dispositif.libelleDispositif",
Expand All @@ -115,7 +116,6 @@ export const getDemandesRestitutionIntentionsQuery = async ({
countDifferenceCapaciteApprentissage(eb).as("differenceCapaciteApprentissage"),
countDifferenceCapaciteScolaireColoree(eb).as("differenceCapaciteScolaireColoree"),
countDifferenceCapaciteApprentissageColoree(eb).as("differenceCapaciteApprentissageColoree"),
sql<string>`count(*) over()`.as("count"),
selectTauxInsertion6mois("indicateurRegionSortie").as("tauxInsertionRegional"),
selectTauxPoursuite("indicateurRegionSortie").as("tauxPoursuiteRegional"),
selectTauxDevenirFavorable("indicateurRegionSortie").as("tauxDevenirFavorableRegional"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ const getStatsRestitutionIntentionsQuery = async ({
.leftJoin("formationScolaireView as formationView", "formationView.cfd", "demande.cfd")
.innerJoin("dataFormation", "dataFormation.cfd", "demande.cfd")
.innerJoin("dataEtablissement", "dataEtablissement.uai", "demande.uai")
.leftJoin("nsf", "formationView.codeNsf", "nsf.codeNsf")
.leftJoin("nsf", "dataFormation.codeNsf", "nsf.codeNsf")
.leftJoin("region", "region.codeRegion", "dataEtablissement.codeRegion")
.leftJoin("academie", "academie.codeAcademie", "dataEtablissement.codeAcademie")
.leftJoin("departement", "departement.codeDepartement", "dataEtablissement.codeDepartement")
.leftJoin("niveauDiplome", "niveauDiplome.codeNiveauDiplome", "formationView.codeNiveauDiplome")
.leftJoin("niveauDiplome", "niveauDiplome.codeNiveauDiplome", "dataFormation.codeNiveauDiplome")
.leftJoin("positionFormationRegionaleQuadrant", (join) =>
join.on((eb) =>
eb.and([
Expand Down Expand Up @@ -135,7 +135,7 @@ const getStatsRestitutionIntentionsQuery = async ({
eb.fn.sum<number>((s) =>
s
.case()
.when(eb("formationView.codeNiveauDiplome", "in", ["561", "461"]))
.when(eb("dataFormation.codeNiveauDiplome", "in", ["561", "461"]))
.then(countPlacesOuvertes(eb))
.else(0)
.end()
Expand All @@ -146,7 +146,7 @@ const getStatsRestitutionIntentionsQuery = async ({
eb.fn.sum<number>((s) =>
s
.case()
.when(eb("formationView.codeNiveauDiplome", "in", ["561", "461"]))
.when(eb("dataFormation.codeNiveauDiplome", "in", ["561", "461"]))
.then(countPlacesOuvertesScolaire(eb))
.else(0)
.end()
Expand All @@ -157,7 +157,7 @@ const getStatsRestitutionIntentionsQuery = async ({
eb.fn.sum<number>((s) =>
s
.case()
.when(eb("formationView.codeNiveauDiplome", "in", ["561", "461"]))
.when(eb("dataFormation.codeNiveauDiplome", "in", ["561", "461"]))
.then(countPlacesOuvertesApprentissage(eb))
.else(0)
.end()
Expand All @@ -172,7 +172,7 @@ const getStatsRestitutionIntentionsQuery = async ({
eb.fn.sum<number>((s) =>
s
.case()
.when(eb("formationView.codeNiveauDiplome", "in", ["381", "481", "581"]))
.when(eb("dataFormation.codeNiveauDiplome", "in", ["381", "481", "581"]))
.then(countPlacesOuvertes(eb))
.else(0)
.end()
Expand All @@ -183,7 +183,7 @@ const getStatsRestitutionIntentionsQuery = async ({
eb.fn.sum<number>((s) =>
s
.case()
.when(eb("formationView.codeNiveauDiplome", "in", ["381", "481", "581"]))
.when(eb("dataFormation.codeNiveauDiplome", "in", ["381", "481", "581"]))
.then(countPlacesOuvertesScolaire(eb))
.else(0)
.end()
Expand All @@ -194,7 +194,7 @@ const getStatsRestitutionIntentionsQuery = async ({
eb.fn.sum<number>((s) =>
s
.case()
.when(eb("formationView.codeNiveauDiplome", "in", ["381", "481", "581"]))
.when(eb("dataFormation.codeNiveauDiplome", "in", ["381", "481", "581"]))
.then(countPlacesOuvertesApprentissage(eb))
.else(0)
.end()
Expand Down Expand Up @@ -277,7 +277,7 @@ const getStatsRestitutionIntentionsQuery = async ({
return eb;
})
.$call((eb) => {
if (codeNiveauDiplome) return eb.where("formationView.codeNiveauDiplome", "in", codeNiveauDiplome);
if (codeNiveauDiplome) return eb.where("dataFormation.codeNiveauDiplome", "in", codeNiveauDiplome);
return eb;
})
.$call((eb) => {
Expand Down Expand Up @@ -318,7 +318,7 @@ const getStatsRestitutionIntentionsQuery = async ({
})
.$call((eb) => {
if (codeNsf && codeNsf.length > 0) {
return eb.where("formationView.codeNsf", "in", codeNsf);
return eb.where("dataFormation.codeNsf", "in", codeNsf);
}

return eb;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const SecondaryFiltersSection = ({
<FormLabel>Formation</FormLabel>
<Multiselect
onClose={filterTracker("cfd")}
width={"64"}
width={"48"}
size="md"
variant={"newInput"}
onChange={(selected) => handleFilters("cfd", selected)}
Expand All @@ -90,7 +90,7 @@ export const SecondaryFiltersSection = ({
<FormLabel>Diplôme</FormLabel>
<Multiselect
onClose={filterTracker("codeNiveauDiplome")}
width={"64"}
width={"48"}
size="md"
variant={"newInput"}
onChange={(selected) => handleFilters("codeNiveauDiplome", selected)}
Expand All @@ -105,7 +105,7 @@ export const SecondaryFiltersSection = ({
<FormLabel>Département</FormLabel>
<Multiselect
onClose={filterTracker("codeDepartement")}
width={"64"}
width={"48"}
size="md"
variant={"newInput"}
onChange={(selected) => handleFilters("codeDepartement", selected)}
Expand All @@ -126,7 +126,7 @@ export const SecondaryFiltersSection = ({
<FormLabel>Établissement</FormLabel>
<Multiselect
onClose={filterTracker("uai")}
width={"64"}
width={"48"}
size="md"
variant={"newInput"}
onChange={(selected) => handleFilters("uai", selected)}
Expand All @@ -140,7 +140,7 @@ export const SecondaryFiltersSection = ({
<Box justifyContent={"start"}>
<FormLabel>Secteur</FormLabel>
<Select
width={"64"}
width={"48"}
size="md"
variant={"newInput"}
value={activeFilters.secteur ?? ""}
Expand All @@ -158,7 +158,7 @@ export const SecondaryFiltersSection = ({
<Box justifyContent={"start"}>
<FormLabel>Voie</FormLabel>
<Select
width={"64"}
width={"48"}
size="md"
variant={"newInput"}
value={activeFilters.voie ?? ""}
Expand Down Expand Up @@ -195,7 +195,7 @@ export const SecondaryFiltersSection = ({
<FormLabel>Type de demande</FormLabel>
<Multiselect
onClose={filterTracker("typeDemande")}
width={"64"}
width={"48"}
size="md"
variant={"newInput"}
onChange={(selected) => handleFilters("typeDemande", selected)}
Expand Down Expand Up @@ -265,7 +265,7 @@ export const SecondaryFiltersSection = ({
<Box justifyContent={"start"}>
<FormLabel>AMI/CMA</FormLabel>
<Select
width={"64"}
width={"48"}
size="md"
variant={"newInput"}
value={activeFilters.amiCMA?.toString() ?? ""}
Expand All @@ -283,7 +283,7 @@ export const SecondaryFiltersSection = ({
<Box justifyContent={"start"}>
<FormLabel>Coloration</FormLabel>
<Select
width={"64"}
width={"48"}
size="md"
variant={"newInput"}
value={activeFilters.coloration?.toString() ?? ""}
Expand All @@ -301,7 +301,7 @@ export const SecondaryFiltersSection = ({
<Box justifyContent={"start"}>
<FormLabel>Position quadrant</FormLabel>
<Select
width={"64"}
width={"48"}
size="md"
variant={"newInput"}
value={activeFilters.positionQuadrant?.toString() ?? ""}
Expand Down Expand Up @@ -340,7 +340,7 @@ export const SecondaryFiltersSection = ({
<Box justifyContent={"start"}>
<FormLabel>Formations spécifiques</FormLabel>
<Multiselect
width={"64"}
width={"48"}
size="md"
variant="newInput"
onChange={(selected) => handleFilters("formationSpecifique", selected)}
Expand Down
5 changes: 2 additions & 3 deletions ui/app/(wrapped)/intentions/restitution/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { TypeFormationSpecifiqueEnum } from "shared/enum/formationSpecifiqueEnum
import { CURRENT_ANNEE_CAMPAGNE } from "shared/time/CURRENT_ANNEE_CAMPAGNE";

import { client } from "@/api.client";
import { FORMATION_ETABLISSEMENT_COLUMNS } from "@/app/(wrapped)/console/etablissements/FORMATION_ETABLISSEMENT_COLUMNS";
import { CodeDepartementFilterContext, CodeRegionFilterContext } from "@/app/layoutClient";
import { GroupedMultiselect } from "@/components/GroupedMultiselect";
import { SearchInput } from "@/components/SearchInput";
Expand All @@ -27,7 +26,7 @@ import { ConsoleSection } from "./ConsoleSection/ConsoleSection";
import { GROUPED_STATS_DEMANDES_COLUMNS_OPTIONAL } from "./GROUPED_STATS_DEMANDES_COLUMN";
import { HeaderSection } from "./HeaderSection/HeaderSection";
import type { STATS_DEMANDES_COLUMNS_OPTIONAL } from "./STATS_DEMANDES_COLUMN";
import { STATS_DEMANDES_COLUMNS_DEFAULT } from "./STATS_DEMANDES_COLUMN";
import { STATS_DEMANDES_COLUMNS, STATS_DEMANDES_COLUMNS_DEFAULT } from "./STATS_DEMANDES_COLUMN";
import type {
DemandesRestitutionIntentions,
FiltersDemandesRestitutionIntentions,
Expand Down Expand Up @@ -296,7 +295,7 @@ export default () => {
};

const columns = {
...FORMATION_ETABLISSEMENT_COLUMNS,
...STATS_DEMANDES_COLUMNS,
...(filters.codeRegion && region ? regionsColumns : {}),
...(filters.codeAcademie && academies ? academiesColumns : {}),
...(filters.codeDepartement && departements ? departementsColumns : {}),
Expand Down

0 comments on commit b3f398d

Please sign in to comment.