diff --git a/src/components/global/api/Controller.js b/src/components/global/api/Controller.js index 39f79d5..23bd5c2 100644 --- a/src/components/global/api/Controller.js +++ b/src/components/global/api/Controller.js @@ -61,18 +61,23 @@ export default class Controller { async getData(n) { if(n === 0) { log("Selector->Controller", "Requete Section 0") + this.view.toggleDisplayDiv("stat", "none") this.model.getModelData0().then((res) => { this.view.renderMenu(this.model.getTitle(), res) + this.view.toggleDisplayDiv("loc", "none") }) this.view.renderPath("") } else if(n === 1) { log("Selector->Controller", "Requete Section 1") + this.view.toggleDisplayDiv("stat", "none") this.model.getModelData1().then((res) => { this.view.renderMenu(this.model.getTitle(), res) this.view.renderPath(this.model.getPath()) + this.view.toggleDisplayDiv("loc", "flex") }) } else if(n === 2) { log("Selector->Controller", "Requete Section 2") + this.view.toggleDisplayDiv("stat", "none") this.model.getModelData2().then((res) => { this.view.renderMenu(this.model.getTitle(), res) this.view.renderPath(this.model.getPath()) @@ -88,9 +93,11 @@ export default class Controller { this.view.renderStat(await data) this.view.renderEtab(await data, `${ this.model.getPath()[1] } - ${ this.model.getPath()[2] }`) this.view.renderPath(this.model.getPath()) - this.model.getMapLink().then((res) => this.view.renderMap(res)) + + this.view.toggleDisplayDiv("stat", "block") } else { + this.view.toggleDisplayDiv("stat", "none") log("Selector->Controller", "Numero de page inconnue") } } diff --git a/src/components/global/api/Model.js b/src/components/global/api/Model.js index 3af9878..fe8a066 100644 --- a/src/components/global/api/Model.js +++ b/src/components/global/api/Model.js @@ -242,7 +242,7 @@ export default class Model { * TODO: (Bilal prends la responsabilite de ce massacre) * */ if(this.state.page.tcat === "Formation d'ingénieur Bac + 5") { - link = `https://data.enseignementsup-recherche.gouv.fr/api/records/1.0/search/?dataset=fr-esr-parcoursup&q=&lang=fr&sort=tri&rows=10000&facet=fili&facet=form_lib_voe_acc&facet=fil_lib_voe_acc&refine.fili=Ecole%20d%27Ing%C3%A9nieur&refine.form_lib_voe_acc=Formations%20%20des%20%C3%A9coles%20d%27ing%C3%A9nieurs&refine.fil_lib_voe_acc=Formation%20d%27ing%C3%A9nieur%20Bac%20%2B%205` + link = `https://data.enseignementsup-recherche.gouv.fr/explore/embed/dataset/fr-esr-parcoursup/map/?timezone=Europe%2FBerlin&sort=tri&facet=fili&facet=fili&facet=form_lib_voe_acc&facet=fil_lib_voe_acc&refine.fili=Ecole%20d%27Ing%C3%A9nieur&refine.form_lib_voe_acc=Formations%20%20des%20%C3%A9coles%20d%27ing%C3%A9nieurs&refine.fil_lib_voe_acc=Formation%20d%27ing%C3%A9nieur%20Bac%20%2B%205&location=9,49.4599,2.06824&basemap=e69ab1` } else if(this.state.page.tcat === "Formation Bac + 3") { link = `https://data.enseignementsup-recherche.gouv.fr/api/records/1.0/search/?dataset=fr-esr-parcoursup&q=&lang=fr&sort=tri&rows=10000&facet=fili&facet=form_lib_voe_acc&facet=fil_lib_voe_acc&refine.fili=Ecole%20d%27Ing%C3%A9nieur&refine.form_lib_voe_acc=Formations%20%20des%20%C3%A9coles%20d%27ing%C3%A9nieurs&refine.fil_lib_voe_acc=Formation%20Bac%20%2B%203` } @@ -281,7 +281,7 @@ export default class Model { * @return { promise } Le lien de la map * */ getMapLink() { - const link = `${this.state.api.maplink}` + + let link = `${this.state.api.maplink}` + `&facet=${encodeURIComponent(this.state.api.facet.filiaire)}` + `&facet=${encodeURIComponent(this.state.api.facet.formation)}` + `&facet=${encodeURIComponent(this.state.api.facet.spec)}` + @@ -290,6 +290,14 @@ export default class Model { `&refine.${encodeURIComponent(this.state.api.facet.spec)}=${encodeURIComponent(this.state.page.tcat)}` + `&location=6,48.04137,1.74683&basemap=e69ab1` + console.log(link) + + if(this.state.page.tcat === "Formation d'ingénieur Bac + 5") { + link = `https://data.enseignementsup-recherche.gouv.fr/api/records/1.0/search/?dataset=fr-esr-parcoursup&q=&lang=fr&sort=tri&rows=10000&facet=fili&facet=form_lib_voe_acc&facet=fil_lib_voe_acc&refine.fili=Ecole%20d%27Ing%C3%A9nieur&refine.form_lib_voe_acc=Formations%20%20des%20%C3%A9coles%20d%27ing%C3%A9nieurs&refine.fil_lib_voe_acc=Formation%20d%27ing%C3%A9nieur%20Bac%20%2B%205` + } else if(this.state.page.tcat === "Formation Bac + 3") { + link = `https://data.enseignementsup-recherche.gouv.fr/explore/embed/dataset/fr-esr-parcoursup/map/?timezone=Europe%2FBerlin&sort=tri&facet=fili&facet=form_lib_voe_acc&facet=fil_lib_voe_acc&refine.fili=Ecole%20d%27Ing%C3%A9nieur&refine.form_lib_voe_acc=Formations%20%20des%20%C3%A9coles%20d%27ing%C3%A9nieurs&refine.fil_lib_voe_acc=Formation%20Bac%20%2B%203&location=6,47.0088,2.09656&basemap=e69ab1` + } + return new Promise((resolve, reject) => { resolve(link) }) diff --git a/src/components/global/api/View.js b/src/components/global/api/View.js index c90578b..eeaecf8 100644 --- a/src/components/global/api/View.js +++ b/src/components/global/api/View.js @@ -7,6 +7,7 @@ export default class View { this.zone = document.getElementById("selector-list-zone") this.path = document.getElementById("loc") this.stat = document.getElementById("generalytics") + this.etabl = document.getElementById("etablanalytics"); this.etab = document.getElementById("etablanalytics-list") this.btn = document.getElementById("selector-top-btn") this.home = document.getElementById("home") @@ -36,6 +37,25 @@ export default class View { log("Selector", "View 1/3") } + /** + * Afficher / cacher les differentes divs + * @param { "loc" | "stat" } which Le nom de l'event + * @param { "block" | "flex" | "none" } mode Le nom du displaya applique + * */ + toggleDisplayDiv(which, mode) { + if(which === "loc" && mode === "flex") { + this.path.style.display = mode + } if(which === "stat" && mode === "block") { + this.stat.style.display = mode + this.etabl.style.display = mode + } if(which === "loc" && mode === "none") { + this.path.style.display = mode + } if(which === "stat" && mode === "none") { + this.stat.style.display = mode + this.etabl.style.display = mode + } + } + /** * Utile pour filtrer le tableau de resultat qui concerne le menu * @param { string } filter La saisie dans le input @@ -145,7 +165,14 @@ export default class View { let etab = e.fields.g_ea_lib_vx let dept = `${e.fields.dep_lib} (${e.fields.dep})` let city = e.fields.ville_etab - let moy = "?" + + let smmoy = (e.fields.pct_sansmention * 11) / 20 + let abmoy = (e.fields.pct_ab * 13) / 20 + let bmoy = (e.fields.pct_b * 15) / 20 + let tbmoy = (e.fields.pct_tb * 17) / 20 + let tbfmoy = (e.fields.pct_tbf * 19) / 20 + let moy = ((smmoy + abmoy + bmoy + tbmoy + tbfmoy) / 5).toFixed(1) + let selection = e.fields.taux_acces_ens let acad = e.fields.acad_mies let type = e.fields.contrat_etab @@ -153,21 +180,21 @@ export default class View { let admishorsacad = e.fields.pct_aca_orig let voeuxtotal = e.fields.voe_tot - let woman = `${ Math.round(100 * e.fields.acc_tot_f / e.fields.acc_tot) }%` - let man = `${ Math.round(100 * (e.fields.acc_tot - e.fields.acc_tot_f) / e.fields.acc_tot) }%` + let woman = `${ Math.floor(100 * e.fields.acc_tot_f / e.fields.acc_tot) }%` + let man = `${ Math.floor(100 * (e.fields.acc_tot - e.fields.acc_tot_f) / e.fields.acc_tot) }%` - let totbac = Math.round(e.fields.acc_bg + e.fields.acc_bp + e.fields.acc_bt + e.fields.acc_at) - let gen = `${ Math.round(100 * e.fields.acc_bg / totbac) }%` - let pro = `${ Math.round(100 * e.fields.acc_bp / totbac) }%` - let tech = `${ Math.round(100 * e.fields.acc_bt / totbac) }%` - let autre = `${ Math.round(100 * e.fields.acc_at / totbac) }%` + let totbac = Math.floor(e.fields.acc_bg + e.fields.acc_bp + e.fields.acc_bt + e.fields.acc_at) + let gen = `${ Math.floor(100 * e.fields.acc_bg / totbac) }%` + let pro = `${ Math.floor(100 * e.fields.acc_bp / totbac) }%` + let tech = `${ Math.floor(100 * e.fields.acc_bt / totbac) }%` + let autre = `${ Math.floor(100 * e.fields.acc_at / totbac) }%` let tot = e.fields.acc_sansmention + e.fields.acc_ab + e.fields.acc_b + e.fields.acc_tb + e.fields.acc_tbf - let p = `${ Math.round(100 * e.fields.acc_sansmention / tot) }%` - let ab = `${ Math.round(100 * e.fields.acc_ab / tot) }%` - let b = `${ Math.round(100 * e.fields.acc_b / tot) }%` - let tb = `${ Math.round(100 * e.fields.acc_tb / tot) }%` - let tbf = `${ Math.round(100 * e.fields.acc_tbf / tot) }%` + let p = `${ Math.floor(100 * e.fields.acc_sansmention / tot) }%` + let ab = `${ Math.floor(100 * e.fields.acc_ab / tot) }%` + let b = `${ Math.floor(100 * e.fields.acc_b / tot) }%` + let tb = `${ Math.floor(100 * e.fields.acc_tb / tot) }%` + let tbf = `${ Math.floor(100 * e.fields.acc_tbf / tot) }%` /** * TODO: Transformer ca en composant riot (GALERE MAX pour faire des ) diff --git a/src/components/global/etablanalytics/etablanalytics.riot b/src/components/global/etablanalytics/etablanalytics.riot index 8047f30..2be3ae3 100644 --- a/src/components/global/etablanalytics/etablanalytics.riot +++ b/src/components/global/etablanalytics/etablanalytics.riot @@ -59,9 +59,7 @@ } -
-
- +