diff --git a/parcoursup/api.js b/parcoursup/api.js
index d7a6f82..72f1e5c 100644
--- a/parcoursup/api.js
+++ b/parcoursup/api.js
@@ -1,60 +1,60 @@
// Échapper les apostrophes dans les valeurs injectées dans la clause where
function echapperValeur(valeur) {
- return String(valeur).replace(/'/g, "\\'")
+ return String(valeur).replace(/'/g, "\\'");
}
// Construire l'URL de requête vers l'API Parcoursup
export function construireURL(requete, limite = 20, decalage = 0, filtres = {}) {
- var url = "https://data.enseignementsup-recherche.gouv.fr/api/explore/v2.1/catalog/datasets/fr-esr-parcoursup/records?"
+ var url = "https://data.enseignementsup-recherche.gouv.fr/api/explore/v2.1/catalog/datasets/fr-esr-parcoursup/records?";
- url += "limit=" + limite
- url += "&offset=" + decalage
+ url += "limit=" + limite;
+ url += "&offset=" + decalage;
- var conditions = []
+ var conditions = [];
if (requete && requete.trim() !== "") {
- conditions.push("search(lib_for_voe_ins, '" + echapperValeur(requete.trim()) + "')")
+ conditions.push("search(lib_for_voe_ins, '" + echapperValeur(requete.trim()) + "')");
}
if (filtres.filiere && filtres.filiere !== "") {
- conditions.push("fili='" + echapperValeur(filtres.filiere) + "'")
+ conditions.push("fili='" + echapperValeur(filtres.filiere) + "'");
}
if (filtres.selectivite && filtres.selectivite !== "") {
- conditions.push("select_form='" + echapperValeur(filtres.selectivite) + "'")
+ conditions.push("select_form='" + echapperValeur(filtres.selectivite) + "'");
}
if (filtres.region && filtres.region !== "") {
- conditions.push("region_etab_aff='" + echapperValeur(filtres.region) + "'")
+ conditions.push("region_etab_aff='" + echapperValeur(filtres.region) + "'");
}
if (filtres.tauxMin && filtres.tauxMin > 0) {
- conditions.push("taux_acces_ens>=" + filtres.tauxMin)
+ conditions.push("taux_acces_ens>=" + filtres.tauxMin);
}
if (filtres.tauxMax && filtres.tauxMax < 100) {
- conditions.push("taux_acces_ens<=" + filtres.tauxMax)
+ conditions.push("taux_acces_ens<=" + filtres.tauxMax);
}
if (conditions.length > 0) {
- url += "&where=" + encodeURIComponent(conditions.join(" AND "))
+ url += "&where=" + encodeURIComponent(conditions.join(" AND "));
}
- return url
+ return url;
}
// Charger les formations depuis l'API Parcoursup
export async function chargerFormations(requete, limite = 20, decalage = 0, filtres = {}) {
- var url = construireURL(requete, limite, decalage, filtres)
- var reponse = await fetch(url)
+ var url = construireURL(requete, limite, decalage, filtres);
+ var reponse = await fetch(url);
if (!reponse.ok) {
- throw new Error("Erreur HTTP " + reponse.status)
+ throw new Error("Erreur HTTP " + reponse.status);
}
- return await reponse.json()
+ return await reponse.json();
}
// Charger l'historique d'une formation sur plusieurs années
@@ -67,42 +67,42 @@ export async function chargerHistoriqueFormation(codUai, nomFormation) {
2023: "fr-esr-parcoursup_2023",
2024: "fr-esr-parcoursup_2024",
2025: "fr-esr-parcoursup"
- }
+ };
- var historique = []
- var nomCourt = echapperValeur((nomFormation || "").substring(0, 40))
- var codeUai = echapperValeur(codUai)
- var annees = [2020, 2021, 2022, 2023, 2024, 2025]
+ var historique = [];
+ var nomCourt = echapperValeur((nomFormation || "").substring(0, 40));
+ var codeUai = echapperValeur(codUai);
+ var annees = [2020, 2021, 2022, 2023, 2024, 2025];
for (var i = 0; i < annees.length; i++) {
- var annee = annees[i]
- var dataset = jeuDeDonnees[annee]
+ var annee = annees[i];
+ var dataset = jeuDeDonnees[annee];
try {
var where =
- "cod_uai='" + codeUai + "' AND search(lib_for_voe_ins, '" + nomCourt + "')"
+ "cod_uai='" + codeUai + "' AND search(lib_for_voe_ins, '" + nomCourt + "')";
var url = "https://data.enseignementsup-recherche.gouv.fr/api/explore/v2.1/catalog/datasets/"
+ dataset + "/records?"
+ "limit=5"
+ "&where=" + encodeURIComponent(where)
- + "&select=" + encodeURIComponent("cod_uai,lib_for_voe_ins,voe_tot,acc_tot,pct_sansmention,pct_ab,pct_b,pct_tb,pct_tbf,pct_bg,pct_bt,pct_bp")
+ + "&select=" + encodeURIComponent("cod_uai,lib_for_voe_ins,voe_tot,acc_tot,pct_sansmention,pct_ab,pct_b,pct_tb,pct_tbf,pct_bg,pct_bt,pct_bp");
- var reponse = await fetch(url)
+ var reponse = await fetch(url);
if (reponse.ok) {
- var donnees = await reponse.json()
+ var donnees = await reponse.json();
if (donnees.results && donnees.results.length > 0) {
- var ligne = donnees.results[0]
- var taux = 0
+ var ligne = donnees.results[0];
+ var taux = 0;
if (ligne.voe_tot && ligne.voe_tot > 0) {
- taux = Math.round((ligne.acc_tot / ligne.voe_tot) * 100)
+ taux = Math.round((ligne.acc_tot / ligne.voe_tot) * 100);
}
historique.push({
@@ -118,14 +118,14 @@ export async function chargerHistoriqueFormation(codUai, nomFormation) {
pctGeneral: ligne.pct_bg || 0,
pctTechno: ligne.pct_bt || 0,
pctPro: ligne.pct_bp || 0
- })
+ });
}
}
} catch (e) {
- console.warn("Erreur pour l'année " + annee + " :", e)
+ console.warn("Erreur pour l'année " + annee + " :", e);
}
}
- return historique
+ return historique;
}
\ No newline at end of file
diff --git a/parcoursup/app.riot b/parcoursup/app.riot
index 6072d0b..28382a3 100644
--- a/parcoursup/app.riot
+++ b/parcoursup/app.riot
@@ -166,44 +166,44 @@
},
onMounted() {
- var saved = localStorage.getItem('selectionFormations')
- var soi = this
+ var saved = localStorage.getItem('selectionFormations');
+ var soi = this;
// Charger la sélection locale si elle existe
if (saved) {
try {
- this.state.selectedFormations = JSON.parse(saved)
+ this.state.selectedFormations = JSON.parse(saved);
} catch (e) {
- console.error('Erreur lecture localStorage :', e)
+ console.error('Erreur lecture localStorage :', e);
}
}
// Écouter les changements de connexion Firebase
window.firebaseServices.onUserChanged(function(user) {
- soi.update({ user: user })
+ soi.update({ user: user });
// Si un utilisateur vient de se connecter, charger sa sélection depuis Firestore
if (user) {
window.firebaseServices.loadUserData(user.uid)
.then(function(donnees) {
if (donnees && donnees.selection) {
- soi.update({ selectedFormations: donnees.selection })
- localStorage.setItem('selectionFormations', JSON.stringify(donnees.selection))
+ soi.update({ selectedFormations: donnees.selection });
+ localStorage.setItem('selectionFormations', JSON.stringify(donnees.selection));
}
})
.catch(function(err) {
- console.error('Erreur chargement Firestore :', err)
- })
+ console.error('Erreur chargement Firestore :', err);
+ });
}
- })
+ });
window.addEventListener('hashchange', function() {
- soi.gererRoute()
- })
+ soi.gererRoute();
+ });
- this.gererRoute()
+ this.gererRoute();
},
// Appelée après une connexion ou inscription réussie
@@ -214,88 +214,88 @@
// Appelée après une déconnexion
surDeconnexion() {
// On vide la sélection : l'utilisateur doit se reconnecter pour retrouver ses formations
- this.update({ selectedFormations: [] })
- localStorage.removeItem('selectionFormations')
+ this.update({ selectedFormations: [] });
+ localStorage.removeItem('selectionFormations');
},
// Sauvegarder la sélection en local ET dans Firestore si connecté
async sauvegarderSelection(selection) {
- localStorage.setItem('selectionFormations', JSON.stringify(selection))
+ localStorage.setItem('selectionFormations', JSON.stringify(selection));
if (this.state.user) {
try {
- await window.firebaseServices.saveUserData(this.state.user.uid, { selection: selection })
+ await window.firebaseServices.saveUserData(this.state.user.uid, { selection: selection });
} catch (err) {
- console.error('Erreur sauvegarde Firestore :', err)
+ console.error('Erreur sauvegarde Firestore :', err);
}
}
},
gererRoute() {
- var ancre = window.location.hash || '#/'
- var chemin = ancre.slice(1) || '/'
+ var ancre = window.location.hash || '#/';
+ var chemin = ancre.slice(1) || '/';
if (chemin.startsWith('/formation/')) {
- var id = decodeURIComponent(chemin.replace('/formation/', ''))
- this.update({ view: 'detail' })
- this.chargerFormationParId(id)
+ var id = decodeURIComponent(chemin.replace('/formation/', ''));
+ this.update({ view: 'detail' });
+ this.chargerFormationParId(id);
} else if (chemin === '/comparateur') {
- this.update({ view: 'comparateur', selected: null })
+ this.update({ view: 'comparateur', selected: null });
} else {
- this.update({ view: 'search', selected: null })
+ this.update({ view: 'search', selected: null });
}
},
async chargerFormationParId(id) {
- var i
+ var i;
for (i = 0; i < this.state.results.length; i++) {
if (this.state.results[i].id === id) {
- this.update({ selected: this.state.results[i] })
- return
+ this.update({ selected: this.state.results[i] });
+ return;
}
}
for (i = 0; i < this.state.selectedFormations.length; i++) {
if (this.state.selectedFormations[i].id === id) {
- this.update({ selected: this.state.selectedFormations[i] })
- return
+ this.update({ selected: this.state.selectedFormations[i] });
+ return;
}
}
try {
- var parties = id.split('-')
- var motCle = parties.slice(1).join(' ').substring(0, 30)
+ var parties = id.split('-');
+ var motCle = parties.slice(1).join(' ').substring(0, 30);
if (motCle) {
- var donnees = await window.chargerFormations(motCle, 10, 0)
+ var donnees = await window.chargerFormations(motCle, 10, 0);
if (donnees.results && donnees.results.length > 0) {
for (i = 0; i < donnees.results.length; i++) {
- var formation = window.creerFormation(donnees.results[i])
+ var formation = window.creerFormation(donnees.results[i]);
if (formation.id === id) {
- this.update({ selected: formation })
- return
+ this.update({ selected: formation });
+ return;
}
}
- this.update({ selected: window.creerFormation(donnees.results[0]) })
+ this.update({ selected: window.creerFormation(donnees.results[0]) });
}
}
} catch (erreur) {
- console.error('Erreur chargement formation :', erreur)
+ console.error('Erreur chargement formation :', erreur);
}
},
afficherDetail(index) {
- var formation = this.state.results[index]
- this.update({ selected: formation, view: 'detail' })
- window.location.hash = '#/formation/' + encodeURIComponent(formation.id)
+ var formation = this.state.results[index];
+ this.update({ selected: formation, view: 'detail' });
+ window.location.hash = '#/formation/' + encodeURIComponent(formation.id);
},
retourRecherche() {
- window.location.hash = '#/'
+ window.location.hash = '#/';
},
async lancerRecherche(requete, filtres) {
@@ -307,38 +307,38 @@
query: requete,
filters: filtres || {},
page: 1
- })
+ });
- window.location.hash = '#/'
- await this.chargerPage(1)
+ window.location.hash = '#/';
+ await this.chargerPage(1);
},
async chargerPage(page) {
- this.update({ loading: true })
+ this.update({ loading: true });
try {
- var decalage = (page - 1) * this.state.limit
+ var decalage = (page - 1) * this.state.limit;
var donnees = await window.chargerFormations(
this.state.query,
this.state.limit,
decalage,
this.state.filters
- )
+ );
- var formations = []
+ var formations = [];
if (donnees.results) {
for (var i = 0; i < donnees.results.length; i++) {
- var brut = donnees.results[i]
- formations.push(window.creerFormation(brut))
+ var brut = donnees.results[i];
+ formations.push(window.creerFormation(brut));
}
}
- var total = 0
+ var total = 0;
if (donnees.total_count) {
- total = donnees.total_count
+ total = donnees.total_count;
}
this.update({
@@ -346,229 +346,229 @@
total: total,
page: page,
loading: false
- })
+ });
} catch (erreur) {
- console.error(erreur)
+ console.error(erreur);
this.update({
results: [],
total: 0,
loading: false
- })
+ });
}
},
nombreTotalPages() {
- return Math.ceil(this.state.total / this.state.limit)
+ return Math.ceil(this.state.total / this.state.limit);
},
async pageSuivante() {
if (this.state.page < this.nombreTotalPages()) {
- await this.chargerPage(this.state.page + 1)
+ await this.chargerPage(this.state.page + 1);
}
},
async pagePrecedente() {
if (this.state.page > 1) {
- await this.chargerPage(this.state.page - 1)
+ await this.chargerPage(this.state.page - 1);
}
},
ajouterSelection(index) {
- var formation = this.state.results[index]
- var selection = this.state.selectedFormations.slice()
- var dejaAjout = false
+ var formation = this.state.results[index];
+ var selection = this.state.selectedFormations.slice();
+ var dejaAjout = false;
for (var i = 0; i < selection.length; i++) {
if (selection[i].id === formation.id) {
- dejaAjout = true
+ dejaAjout = true;
}
}
if (!dejaAjout) {
- selection.push(formation)
- this.update({ selectedFormations: selection })
- this.sauvegarderSelection(selection)
+ selection.push(formation);
+ this.update({ selectedFormations: selection });
+ this.sauvegarderSelection(selection);
}
},
retirerSelection(id) {
- var nouvelleSelection = []
+ var nouvelleSelection = [];
for (var i = 0; i < this.state.selectedFormations.length; i++) {
- var f = this.state.selectedFormations[i]
+ var f = this.state.selectedFormations[i];
if (f.id !== id) {
- nouvelleSelection.push(f)
+ nouvelleSelection.push(f);
}
}
- this.update({ selectedFormations: nouvelleSelection })
- this.sauvegarderSelection(nouvelleSelection)
+ this.update({ selectedFormations: nouvelleSelection });
+ this.sauvegarderSelection(nouvelleSelection);
},
viderSelection() {
- this.update({ selectedFormations: [] })
- this.sauvegarderSelection([])
+ this.update({ selectedFormations: [] });
+ this.sauvegarderSelection([]);
},
mettreAJourNote(e) {
- this.update({ note: Number(e.target.value) })
+ this.update({ note: Number(e.target.value) });
},
mettreAJourSerie(e) {
- this.update({ serie: e.target.value })
+ this.update({ serie: e.target.value });
},
mettreAJourTri(e) {
- this.update({ sortBy: e.target.value })
+ this.update({ sortBy: e.target.value });
},
obtenirSelectionTriee() {
- var selection = this.state.selectedFormations.slice()
- var soi = this
+ var selection = this.state.selectedFormations.slice();
+ var soi = this;
if (this.state.sortBy === 'taux') {
- selection.sort(function(a, b) { return b.tauxAcces - a.tauxAcces })
+ selection.sort(function(a, b) { return b.tauxAcces - a.tauxAcces; });
} else if (this.state.sortBy === 'ville') {
- selection.sort(function(a, b) { return a.ville.localeCompare(b.ville) })
+ selection.sort(function(a, b) { return a.ville.localeCompare(b.ville); });
} else if (this.state.sortBy === 'estimation') {
- selection.sort(function(a, b) { return soi.calculerScore(b) - soi.calculerScore(a) })
+ selection.sort(function(a, b) { return soi.calculerScore(b) - soi.calculerScore(a); });
} else {
- selection.sort(function(a, b) { return a.nom.localeCompare(b.nom) })
+ selection.sort(function(a, b) { return a.nom.localeCompare(b.nom); });
}
- return selection
+ return selection;
},
pourcentageSerie(f) {
if (this.state.serie === 'general') {
- return f.pctGeneral || 0
+ return f.pctGeneral || 0;
}
if (this.state.serie === 'techno') {
- return f.pctTechno || 0
+ return f.pctTechno || 0;
}
if (this.state.serie === 'pro') {
- return f.pctPro || 0
+ return f.pctPro || 0;
}
- return 0
+ return 0;
},
calculerScore(f) {
- var score = 0
- var note = this.state.note
- var tauxAcces = f.tauxAcces || 0
- var pctSerie = this.pourcentageSerie(f)
+ var score = 0;
+ var note = this.state.note;
+ var tauxAcces = f.tauxAcces || 0;
+ var pctSerie = this.pourcentageSerie(f);
if (tauxAcces >= 80) {
- score += 30
+ score += 30;
} else if (tauxAcces >= 50) {
- score += 24
+ score += 24;
} else if (tauxAcces >= 30) {
- score += 16
+ score += 16;
} else if (tauxAcces >= 15) {
- score += 8
+ score += 8;
} else {
- score += 2
+ score += 2;
}
if (note >= 17) {
- score += 40
+ score += 40;
} else if (note >= 15) {
- score += 32
+ score += 32;
} else if (note >= 13) {
- score += 22
+ score += 22;
} else if (note >= 11) {
- score += 14
+ score += 14;
} else if (note >= 9) {
- score += 6
+ score += 6;
} else {
- score += 0
+ score += 0;
}
if (pctSerie >= 60) {
- score += 30
+ score += 30;
} else if (pctSerie >= 40) {
- score += 24
+ score += 24;
} else if (pctSerie >= 20) {
- score += 16
+ score += 16;
} else if (pctSerie >= 5) {
- score += 8
+ score += 8;
} else {
- score += 0
+ score += 0;
}
- return score
+ return score;
},
estimerFormation(f) {
- var score = this.calculerScore(f)
+ var score = this.calculerScore(f);
if (score >= 85) {
- return 'Très favorable'
+ return 'Très favorable';
}
if (score >= 65) {
- return 'Favorable'
+ return 'Favorable';
}
if (score >= 45) {
- return 'Possible'
+ return 'Possible';
}
if (score >= 25) {
- return 'Difficile'
+ return 'Difficile';
}
- return 'Très difficile'
+ return 'Très difficile';
},
classeEstimation(f) {
- var resultat = this.estimerFormation(f)
+ var resultat = this.estimerFormation(f);
if (resultat === 'Très favorable') {
- return 'estimate tres-favorable'
+ return 'estimate tres-favorable';
}
if (resultat === 'Favorable') {
- return 'estimate favorable'
+ return 'estimate favorable';
}
if (resultat === 'Possible') {
- return 'estimate possible'
+ return 'estimate possible';
}
if (resultat === 'Difficile') {
- return 'estimate difficile'
+ return 'estimate difficile';
}
- return 'estimate tres-difficile'
+ return 'estimate tres-difficile';
},
classeCarte(f) {
- var resultat = this.estimerFormation(f)
+ var resultat = this.estimerFormation(f);
if (resultat === 'Très favorable') {
- return 'card card-tres-favorable'
+ return 'card card-tres-favorable';
}
if (resultat === 'Favorable') {
- return 'card card-favorable'
+ return 'card card-favorable';
}
if (resultat === 'Possible') {
- return 'card card-possible'
+ return 'card card-possible';
}
if (resultat === 'Difficile') {
- return 'card card-difficile'
+ return 'card card-difficile';
}
- return 'card card-tres-difficile'
+ return 'card card-tres-difficile';
},
detailEstimation(f) {
- var tauxAcces = f.tauxAcces || 0
- var pctSerie = this.pourcentageSerie(f)
- var nomSerie = ''
+ var tauxAcces = f.tauxAcces || 0;
+ var pctSerie = this.pourcentageSerie(f);
+ var nomSerie = '';
if (this.state.serie === 'general') {
- nomSerie = 'Gén'
+ nomSerie = 'Gén';
} else if (this.state.serie === 'techno') {
- nomSerie = 'Techno'
+ nomSerie = 'Techno';
} else {
- nomSerie = 'Pro'
+ nomSerie = 'Pro';
}
- return 'Taux ' + tauxAcces + '% · ' + nomSerie + ' ' + pctSerie + '% · Note ' + this.state.note + '/20'
+ return 'Taux ' + tauxAcces + '% · ' + nomSerie + ' ' + pctSerie + '% · Note ' + this.state.note + '/20';
}
- }
+ };
diff --git a/parcoursup/components/auth-panel.riot b/parcoursup/components/auth-panel.riot
index 4fa0727..0a29203 100644
--- a/parcoursup/components/auth-panel.riot
+++ b/parcoursup/components/auth-panel.riot
@@ -83,17 +83,17 @@
},
ouvrirModale() {
- this.update({ visible: true, erreur: null })
+ this.update({ visible: true, erreur: null });
},
fermerModale() {
- this.update({ visible: false, erreur: null })
+ this.update({ visible: false, erreur: null });
},
// Fermer si l'utilisateur clique en dehors de la modale
cliquerFond(e) {
if (e.target === e.currentTarget) {
- this.fermerModale()
+ this.fermerModale();
}
},
@@ -105,7 +105,7 @@
labelBouton: 'Se connecter',
classBtnConnexion: 'auth-tab active',
classBtnInscription: 'auth-tab'
- })
+ });
},
afficherInscription() {
@@ -116,59 +116,59 @@
labelBouton: 'Créer le compte',
classBtnConnexion: 'auth-tab',
classBtnInscription: 'auth-tab active'
- })
+ });
},
async validerFormulaire(e) {
- e.preventDefault()
+ e.preventDefault();
- var email = e.target.email.value.trim()
- var password = e.target.password.value
- var services = window.firebaseServices
+ var email = e.target.email.value.trim();
+ var password = e.target.password.value;
+ var services = window.firebaseServices;
- this.update({ chargement: true, erreur: null })
+ this.update({ chargement: true, erreur: null });
try {
if (this.state.mode === 'inscription') {
- await services.createAccount(email, password)
+ await services.createAccount(email, password);
} else {
- await services.login(email, password)
+ await services.login(email, password);
}
- this.update({ visible: false, chargement: false })
- this.props.onauth && this.props.onauth()
+ this.update({ visible: false, chargement: false });
+ this.props.onauth && this.props.onauth();
} catch (err) {
- var messageErreur = 'Une erreur est survenue.'
+ var messageErreur = 'Une erreur est survenue.';
if (err.code === 'auth/email-already-in-use') {
- messageErreur = 'Cet e-mail est déjà utilisé.'
+ messageErreur = 'Cet e-mail est déjà utilisé.';
} else if (err.code === 'auth/invalid-email') {
- messageErreur = 'Adresse e-mail invalide.'
+ messageErreur = 'Adresse e-mail invalide.';
} else if (err.code === 'auth/wrong-password' || err.code === 'auth/invalid-credential') {
- messageErreur = 'E-mail ou mot de passe incorrect.'
+ messageErreur = 'E-mail ou mot de passe incorrect.';
} else if (err.code === 'auth/weak-password') {
- messageErreur = 'Le mot de passe doit faire au moins 6 caractères.'
+ messageErreur = 'Le mot de passe doit faire au moins 6 caractères.';
} else if (err.code === 'auth/user-not-found') {
- messageErreur = 'Aucun compte trouvé avec cet e-mail.'
+ messageErreur = 'Aucun compte trouvé avec cet e-mail.';
}
- this.update({ chargement: false, erreur: messageErreur })
+ this.update({ chargement: false, erreur: messageErreur });
}
},
async seDeconnecter() {
try {
- await window.firebaseServices.logout()
- this.props.onlogout && this.props.onlogout()
+ await window.firebaseServices.logout();
+ this.props.onlogout && this.props.onlogout();
} catch (err) {
- console.error('Erreur déconnexion :', err)
+ console.error('Erreur déconnexion :', err);
}
}
- }
+ };
diff --git a/parcoursup/components/detail-view.riot b/parcoursup/components/detail-view.riot
index bdaefc6..fa62d88 100644
--- a/parcoursup/components/detail-view.riot
+++ b/parcoursup/components/detail-view.riot
@@ -203,57 +203,57 @@
},
onMounted() {
- this.afficherGraphiques()
- this.chargerHistorique()
+ this.afficherGraphiques();
+ this.chargerHistorique();
},
onUpdated() {
- this.afficherGraphiques()
+ this.afficherGraphiques();
if (this.state.historique.length > 0) {
- this.afficherGraphiquesHistoriques()
+ this.afficherGraphiquesHistoriques();
}
},
// Retour à la liste des résultats
retourListe() {
- this.props.onback()
+ this.props.onback();
},
// Limiter une valeur entre 0 et 1 pour Charts.css
limiterValeur(val) {
if (val === null || val === undefined || isNaN(val)) {
- return 0
+ return 0;
}
- var v = val / 100
+ var v = val / 100;
if (v > 1) {
- return 1
+ return 1;
}
if (v < 0) {
- return 0
+ return 0;
}
- return Math.round(v * 100) / 100
+ return Math.round(v * 100) / 100;
},
afficherGraphiques() {
- var f = this.props.formation
+ var f = this.props.formation;
if (!f) {
- return
+ return;
}
- var graphBac = this.$('[ref="graphBac"]')
- var graphMentions = this.$('[ref="graphMentions"]')
- var graphProfil = this.$('[ref="graphProfil"]')
+ var graphBac = this.$('[ref="graphBac"]');
+ var graphMentions = this.$('[ref="graphMentions"]');
+ var graphProfil = this.$('[ref="graphProfil"]');
if (graphBac) {
graphBac.innerHTML = this.construireGraphiqueColonnes([
{ label: 'Général', valeur: f.pctGeneral, couleur: '#3d7fff' },
{ label: 'Techno', valeur: f.pctTechno, couleur: '#f59e0b' },
{ label: 'Pro', valeur: f.pctPro, couleur: '#10b981' }
- ])
+ ]);
}
if (graphMentions) {
@@ -263,7 +263,7 @@
{ label: 'Bien', valeur: f.pctB, couleur: '#34d399' },
{ label: 'TB', valeur: f.pctTB, couleur: '#fbbf24' },
{ label: 'TB Féli.', valeur: f.pctTBF, couleur: '#f472b6' }
- ])
+ ]);
}
if (graphProfil) {
@@ -271,158 +271,158 @@
{ label: 'Femmes', valeur: f.pctFemmes, couleur: '#a78bfa' },
{ label: 'Boursiers', valeur: f.pctBoursiers, couleur: '#fb923c' },
{ label: 'Néo-bac', valeur: f.pctNeoBac, couleur: '#2dd4bf' }
- ])
+ ]);
}
},
async chargerHistorique() {
- var f = this.props.formation
+ var f = this.props.formation;
if (!f) {
- return
+ return;
}
- var codUai = f.id.split('-')[0]
+ var codUai = f.id.split('-')[0];
if (!codUai || !window.chargerHistoriqueFormation) {
- return
+ return;
}
- this.update({ chargementHistorique: true })
+ this.update({ chargementHistorique: true });
try {
- var historique = await window.chargerHistoriqueFormation(codUai, f.nom)
- this.update({ historique: historique, chargementHistorique: false })
+ var historique = await window.chargerHistoriqueFormation(codUai, f.nom);
+ this.update({ historique: historique, chargementHistorique: false });
} catch (e) {
- console.error('Erreur chargement historique :', e)
- this.update({ historique: [], chargementHistorique: false })
+ console.error('Erreur chargement historique :', e);
+ this.update({ historique: [], chargementHistorique: false });
}
},
afficherGraphiquesHistoriques() {
- var historique = this.state.historique
+ var historique = this.state.historique;
if (!historique || historique.length === 0) {
- return
+ return;
}
- var graphTaux = this.$('[ref="graphTaux"]')
- var graphCandidats = this.$('[ref="graphCandidats"]')
- var graphMentionsHist = this.$('[ref="graphMentionsHist"]')
+ var graphTaux = this.$('[ref="graphTaux"]');
+ var graphCandidats = this.$('[ref="graphCandidats"]');
+ var graphMentionsHist = this.$('[ref="graphMentionsHist"]');
// Graphique : taux d'accès par année
if (graphTaux) {
- var elementsAnnee = []
+ var elementsAnnee = [];
for (var i = 0; i < historique.length; i++) {
elementsAnnee.push({
label: '' + historique[i].annee,
valeur: historique[i].tauxAcces,
couleur: '#1a936f'
- })
+ });
}
- graphTaux.innerHTML = this.construireGraphiqueColonnes(elementsAnnee)
+ graphTaux.innerHTML = this.construireGraphiqueColonnes(elementsAnnee);
}
// Graphique : candidats vs admis
if (graphCandidats) {
- var maxCandidats = 0
+ var maxCandidats = 0;
for (var i = 0; i < historique.length; i++) {
if (historique[i].candidats > maxCandidats) {
- maxCandidats = historique[i].candidats
+ maxCandidats = historique[i].candidats;
}
}
- var lignes = ''
+ var lignes = '';
for (var i = 0; i < historique.length; i++) {
- var h = historique[i]
- var tailleCand = 0
- var tailleAdmis = 0
+ var h = historique[i];
+ var tailleCand = 0;
+ var tailleAdmis = 0;
if (maxCandidats > 0) {
- tailleCand = Math.round((h.candidats / maxCandidats) * 100) / 100
- tailleAdmis = Math.round((h.admis / maxCandidats) * 100) / 100
+ tailleCand = Math.round((h.candidats / maxCandidats) * 100) / 100;
+ tailleAdmis = Math.round((h.admis / maxCandidats) * 100) / 100;
}
- lignes += '
'
- lignes += '| ' + h.annee + ' | '
- lignes += ''
- lignes += '' + h.candidats + ' | '
- lignes += ''
- lignes += '' + h.admis + ' | '
- lignes += '
'
+ lignes += '';
+ lignes += '| ' + h.annee + ' | ';
+ lignes += '';
+ lignes += '' + h.candidats + ' | ';
+ lignes += '';
+ lignes += '' + h.admis + ' | ';
+ lignes += '
';
}
graphCandidats.innerHTML = ''
+ '| Année | Candidats | Admis |
'
- + '' + lignes + '
'
+ + '' + lignes + '';
}
// Tableau : évolution des mentions
if (graphMentionsHist) {
- var tableau = ''
- tableau += '| Année | Sans mention | AB | Bien | TB | TB Féli. |
'
- tableau += ''
+ var tableau = '';
+ tableau += '| Année | Sans mention | AB | Bien | TB | TB Féli. |
';
+ tableau += '';
for (var i = 0; i < historique.length; i++) {
- var h = historique[i]
- tableau += ''
- tableau += '| ' + h.annee + ' | '
- tableau += '' + h.pctSansMention + '% | '
- tableau += '' + h.pctAB + '% | '
- tableau += '' + h.pctB + '% | '
- tableau += '' + h.pctTB + '% | '
- tableau += '' + h.pctTBF + '% | '
- tableau += '
'
+ var h = historique[i];
+ tableau += '';
+ tableau += '| ' + h.annee + ' | ';
+ tableau += '' + h.pctSansMention + '% | ';
+ tableau += '' + h.pctAB + '% | ';
+ tableau += '' + h.pctB + '% | ';
+ tableau += '' + h.pctTB + '% | ';
+ tableau += '' + h.pctTBF + '% | ';
+ tableau += '
';
}
- tableau += '
'
- graphMentionsHist.innerHTML = tableau
+ tableau += '
';
+ graphMentionsHist.innerHTML = tableau;
}
},
construireGraphiqueColonnes(elements) {
- var lignes = ''
+ var lignes = '';
for (var i = 0; i < elements.length; i++) {
- var el = elements[i]
- var taille = this.limiterValeur(el.valeur)
- var affiche = el.valeur || 0
+ var el = elements[i];
+ var taille = this.limiterValeur(el.valeur);
+ var affiche = el.valeur || 0;
- lignes += ''
- lignes += '| ' + el.label + ' | '
- lignes += ''
- lignes += '' + affiche + '%'
- lignes += ' |
'
+ lignes += '';
+ lignes += '| ' + el.label + ' | ';
+ lignes += '';
+ lignes += '' + affiche + '%';
+ lignes += ' |
';
}
return ''
+ '| Type | % |
'
- + '' + lignes + '
'
+ + '' + lignes + '';
},
construireGraphiqueBarres(elements) {
- var lignes = ''
+ var lignes = '';
for (var i = 0; i < elements.length; i++) {
- var el = elements[i]
- var taille = this.limiterValeur(el.valeur)
- var affiche = el.valeur || 0
+ var el = elements[i];
+ var taille = this.limiterValeur(el.valeur);
+ var affiche = el.valeur || 0;
- lignes += ''
- lignes += '| ' + el.label + ' | '
- lignes += ''
- lignes += '' + affiche + '%'
- lignes += ' |
'
+ lignes += '';
+ lignes += '| ' + el.label + ' | ';
+ lignes += '';
+ lignes += '' + affiche + '%';
+ lignes += ' |
';
}
return ''
+ '| Catégorie | % |
'
- + '' + lignes + '
'
+ + '' + lignes + '';
}
- }
+ };
diff --git a/parcoursup/components/map-view.riot b/parcoursup/components/map-view.riot
index e3a9805..d719bba 100644
--- a/parcoursup/components/map-view.riot
+++ b/parcoursup/components/map-view.riot
@@ -8,113 +8,113 @@
export default {
onMounted() {
- var divCarte = this.$('div[ref="carte"]')
+ var divCarte = this.$('div[ref="carte"]');
- this.carte = L.map(divCarte).setView([46.8, 2.5], 6)
- this.groupeMarqueurs = L.layerGroup().addTo(this.carte)
- this.marqueursIndex = {}
+ this.carte = L.map(divCarte).setView([46.8, 2.5], 6);
+ this.groupeMarqueurs = L.layerGroup().addTo(this.carte);
+ this.marqueursIndex = {};
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors'
- }).addTo(this.carte)
+ }).addTo(this.carte);
- this.afficherMarqueurs()
+ this.afficherMarqueurs();
- var composant = this
+ var composant = this;
setTimeout(function() {
if (composant.carte) {
- composant.carte.invalidateSize()
+ composant.carte.invalidateSize();
}
- }, 200)
+ }, 200);
setTimeout(function() {
if (composant.carte) {
- composant.carte.invalidateSize()
+ composant.carte.invalidateSize();
}
- }, 500)
+ }, 500);
window.mapFocus = function(id) {
- composant.centrerSurFormation(id)
- }
+ composant.centrerSurFormation(id);
+ };
},
onUpdated() {
- this.afficherMarqueurs()
+ this.afficherMarqueurs();
- var composant = this
+ var composant = this;
if (this.carte) {
setTimeout(function() {
- composant.carte.invalidateSize()
- }, 100)
+ composant.carte.invalidateSize();
+ }, 100);
setTimeout(function() {
- composant.carte.invalidateSize()
- }, 300)
+ composant.carte.invalidateSize();
+ }, 300);
}
},
onBeforeUnmount() {
if (this.carte) {
- this.carte.remove()
- this.carte = null
+ this.carte.remove();
+ this.carte = null;
}
- window.mapFocus = null
+ window.mapFocus = null;
},
afficherMarqueurs() {
if (!this.carte || !this.groupeMarqueurs) {
- return
+ return;
}
- this.groupeMarqueurs.clearLayers()
- this.marqueursIndex = {}
+ this.groupeMarqueurs.clearLayers();
+ this.marqueursIndex = {};
- var coordonnees = []
- var formations = this.props.results || []
+ var coordonnees = [];
+ var formations = this.props.results || [];
for (var i = 0; i < formations.length; i++) {
- var f = formations[i]
+ var f = formations[i];
if (f.latitude != null && f.longitude != null) {
- var marqueur = L.marker([f.latitude, f.longitude])
- marqueur.bindPopup('' + f.nom + '
' + f.ville)
- marqueur.addTo(this.groupeMarqueurs)
+ var marqueur = L.marker([f.latitude, f.longitude]);
+ marqueur.bindPopup('' + f.nom + '
' + f.ville);
+ marqueur.addTo(this.groupeMarqueurs);
- this.marqueursIndex[f.id] = marqueur
- coordonnees.push([f.latitude, f.longitude])
+ this.marqueursIndex[f.id] = marqueur;
+ coordonnees.push([f.latitude, f.longitude]);
}
}
if (coordonnees.length > 0) {
- this.carte.fitBounds(coordonnees, { padding: [20, 20] })
+ this.carte.fitBounds(coordonnees, { padding: [20, 20] });
} else {
- this.carte.setView([46.8, 2.5], 6)
+ this.carte.setView([46.8, 2.5], 6);
}
},
centrerSurFormation(id) {
- var marqueur = this.marqueursIndex[id]
+ var marqueur = this.marqueursIndex[id];
if (marqueur && this.carte) {
- var divCarte = this.$('div[ref="carte"]')
+ var divCarte = this.$('div[ref="carte"]');
if (divCarte) {
- divCarte.scrollIntoView({ behavior: 'smooth', block: 'center' })
+ divCarte.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
- var composant = this
+ var composant = this;
setTimeout(function() {
- composant.carte.invalidateSize()
- composant.carte.setView(marqueur.getLatLng(), 13, { animate: true })
- marqueur.openPopup()
- }, 400)
+ composant.carte.invalidateSize();
+ composant.carte.setView(marqueur.getLatLng(), 13, { animate: true });
+ marqueur.openPopup();
+ }, 400);
}
}
- }
+ };
diff --git a/parcoursup/components/result-list.riot b/parcoursup/components/result-list.riot
index 5fa57f8..28d25cb 100644
--- a/parcoursup/components/result-list.riot
+++ b/parcoursup/components/result-list.riot
@@ -28,22 +28,22 @@
// Déclencher l'affichage du détail d'une formation
afficherDetail(index) {
- this.props.ondetail(index)
+ this.props.ondetail(index);
},
// Ajouter une formation à la sélection
ajouterALaSelection(index) {
- this.props.onselect(index)
+ this.props.onselect(index);
},
// Centrer la carte sur la formation
localiserSurCarte(formation) {
if (window.mapFocus) {
- window.mapFocus(formation.id)
+ window.mapFocus(formation.id);
}
}
- }
+ };
diff --git a/parcoursup/components/search-bar.riot b/parcoursup/components/search-bar.riot
index 81c2937..ebc5337 100644
--- a/parcoursup/components/search-bar.riot
+++ b/parcoursup/components/search-bar.riot
@@ -27,11 +27,7 @@
-
-
-
-
@@ -100,39 +96,39 @@
},
updateQuery(e) {
- this.update({ query: e.target.value })
+ this.update({ query: e.target.value });
},
handleKey(e) {
if (e.key === 'Enter') {
- this.submitSearch()
+ this.submitSearch();
}
},
toggleFilters() {
- var visible = !this.state.showFilters
- var label = visible ? 'Masquer les filtres' : 'Filtres avancés'
- this.update({ showFilters: visible, labelFiltres: label })
+ var visible = !this.state.showFilters;
+ var label = visible ? 'Masquer les filtres' : 'Filtres avancés';
+ this.update({ showFilters: visible, labelFiltres: label });
},
updateFiliere(e) {
- this.update({ filiere: e.target.value })
+ this.update({ filiere: e.target.value });
},
updateSelectivite(e) {
- this.update({ selectivite: e.target.value })
+ this.update({ selectivite: e.target.value });
},
updateRegion(e) {
- this.update({ region: e.target.value })
+ this.update({ region: e.target.value });
},
updateTauxMin(e) {
- this.update({ tauxMin: Number(e.target.value) })
+ this.update({ tauxMin: Number(e.target.value) });
},
updateTauxMax(e) {
- this.update({ tauxMax: Number(e.target.value) })
+ this.update({ tauxMax: Number(e.target.value) });
},
submitSearch() {
@@ -142,10 +138,10 @@
region: this.state.region,
tauxMin: this.state.tauxMin,
tauxMax: this.state.tauxMax
- }
+ };
- this.props.onsearch(this.state.query, filters)
+ this.props.onsearch(this.state.query, filters);
}
- }
+ };
diff --git a/parcoursup/formation.js b/parcoursup/formation.js
index eedec42..fbe770e 100644
--- a/parcoursup/formation.js
+++ b/parcoursup/formation.js
@@ -1,17 +1,17 @@
// Créer un objet formation à partir des données brutes de l'API
export function creerFormation(brut) {
- var taux = 0
- var latitude = null
- var longitude = null
+ var taux = 0;
+ var latitude = null;
+ var longitude = null;
if (brut.voe_tot && brut.voe_tot > 0) {
- taux = Math.round((brut.acc_tot / brut.voe_tot) * 100)
+ taux = Math.round((brut.acc_tot / brut.voe_tot) * 100);
}
if (brut.g_olocalisation_des_formations) {
- latitude = brut.g_olocalisation_des_formations.lat
- longitude = brut.g_olocalisation_des_formations.lon
+ latitude = brut.g_olocalisation_des_formations.lat;
+ longitude = brut.g_olocalisation_des_formations.lon;
}
return {
@@ -93,5 +93,5 @@ export function creerFormation(brut) {
classesPCTotal: brut.nb_cla_pc,
acceptesPCTotal: brut.acc_pc
- }
+ };
}
\ No newline at end of file