From f9b19326f8816b978224dedc141257557c08aa6c Mon Sep 17 00:00:00 2001 From: yolou Date: Wed, 18 Mar 2026 12:45:44 +0100 Subject: [PATCH] passage du prototype en composant riot simple --- parcoursup/api.js | 38 +++++++-------- parcoursup/app.riot | 105 ++++++++++++++++++++++++++++++++++++++++ parcoursup/formation.js | 44 ++++++++--------- parcoursup/index.html | 23 +++++---- 4 files changed, 160 insertions(+), 50 deletions(-) create mode 100644 parcoursup/app.riot diff --git a/parcoursup/api.js b/parcoursup/api.js index a6b10da..789a836 100644 --- a/parcoursup/api.js +++ b/parcoursup/api.js @@ -1,21 +1,21 @@ export function buildURL(query) { - let url = - "https://data.enseignementsup-recherche.gouv.fr/api/explore/v2.1/catalog/datasets/fr-esr-parcoursup/records?limit=10" - - if (query && query.trim() !== "") { - url += "&where=search(lib_for_voe_ins, '" + query + "')" - } - - return url + let url = + "https://data.enseignementsup-recherche.gouv.fr/api/explore/v2.1/catalog/datasets/fr-esr-parcoursup/records?limit=10" + + if (query && query.trim() !== "") { + url += "&where=search(lib_for_voe_ins, '" + query + "')" } - - export async function fetchFormations(query) { - const url = buildURL(query) - const response = await fetch(url) - - if (!response.ok) { - throw new Error("Erreur HTTP") - } - - return await response.json() - } \ No newline at end of file + + return url +} + +export async function fetchFormations(query) { + const url = buildURL(query) + const response = await fetch(url) + + if (!response.ok) { + throw new Error("Erreur HTTP") + } + + return await response.json() +} \ No newline at end of file diff --git a/parcoursup/app.riot b/parcoursup/app.riot new file mode 100644 index 0000000..72fcb55 --- /dev/null +++ b/parcoursup/app.riot @@ -0,0 +1,105 @@ + +

Mini projet Parcoursup

+

Recherche de formations Parcoursup avec Riot

+ +
+ + + +

Chargement...

+

+ Aucun résultat trouvé +

+ +
+

{ f.nom }

+

Établissement : { f.etablissement }

+

Ville : { f.ville } ({ f.departement })

+

Filière : { f.filiere }

+

Taux d'accès : { f.tauxAcces }%

+ +
+
+ +
+

{ state.selected.nom }

+

Établissement : { state.selected.etablissement }

+

Ville : { state.selected.ville }

+

Département : { state.selected.departement }

+

Filière : { state.selected.filiere }

+

Sélectivité : { state.selected.selectivite }

+

Capacité : { state.selected.capacite }

+

Candidats : { state.selected.candidats }

+

Admis : { state.selected.admis }

+

Taux d'accès : { state.selected.tauxAcces }%

+ + +
+ + +
\ No newline at end of file diff --git a/parcoursup/formation.js b/parcoursup/formation.js index a7931d1..b03f51f 100644 --- a/parcoursup/formation.js +++ b/parcoursup/formation.js @@ -1,23 +1,23 @@ export function createFormation(raw) { - let taux = 0 - - if (raw.voe_tot && raw.voe_tot > 0) { - taux = Math.round((raw.acc_tot / raw.voe_tot) * 100) - } - - return { - id: raw.cod_uai + "-" + raw.lib_for_voe_ins, - nom: raw.lib_for_voe_ins, - etablissement: raw.g_ea_lib_vx, - ville: raw.ville_etab, - departement: raw.dep, - filiere: raw.fili, - selectivite: raw.select_form, - capacite: raw.capa_fin, - candidats: raw.voe_tot, - admis: raw.acc_tot, - tauxAcces: taux, - latitude: raw.g_olocalisation_des_formations ? raw.g_olocalisation_des_formations.lat : null, - longitude: raw.g_olocalisation_des_formations ? raw.g_olocalisation_des_formations.lon : null - } - } \ No newline at end of file + let taux = 0 + + if (raw.voe_tot && raw.voe_tot > 0) { + taux = Math.round((raw.acc_tot / raw.voe_tot) * 100) + } + + return { + id: raw.cod_uai + "-" + raw.lib_for_voe_ins, + nom: raw.lib_for_voe_ins, + etablissement: raw.g_ea_lib_vx, + ville: raw.ville_etab, + departement: raw.dep, + filiere: raw.fili, + selectivite: raw.select_form, + capacite: raw.capa_fin, + candidats: raw.voe_tot, + admis: raw.acc_tot, + tauxAcces: taux, + latitude: raw.g_olocalisation_des_formations ? raw.g_olocalisation_des_formations.lat : null, + longitude: raw.g_olocalisation_des_formations ? raw.g_olocalisation_des_formations.lon : null + } +} \ No newline at end of file diff --git a/parcoursup/index.html b/parcoursup/index.html index 321d43e..1485d37 100644 --- a/parcoursup/index.html +++ b/parcoursup/index.html @@ -3,18 +3,23 @@ - Parcoursup - test API + Parcoursup Riot + + + -

Mini projet Parcoursup

-

Recherche de formations Parcoursup

+ - - + -
En attente...
- - - + \ No newline at end of file