This commit is contained in:
pro.boooooo 2023-03-28 23:59:15 +02:00
parent f2db9a1bd3
commit cd3ca158e4
7 changed files with 64 additions and 32 deletions

View File

@ -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")
}
}

View File

@ -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)
})

View File

@ -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 <tr><etablanalyticsfragment/></tr>)

View File

@ -59,9 +59,7 @@
}
</style>
<div id="etablanalytics">
<div id="etablanalytics-map-container"></div>
<div id="etablanalytics" style="display: none;">
<div id="etablanalytics-search-container">
<input type="text" id="etablanalytics-search" />
</div>

View File

@ -11,7 +11,5 @@
}
</style>
<div id="generalytics">
</div>
<div id="generalytics" style="display: none;"></div>
</generalytics>

View File

@ -11,11 +11,5 @@
}
</style>
<div id="loc"></div>
<script>
export default {
props: ["msg"]
}
</script>
<div id="loc" style="display: none;"></div>
</loc>

View File

@ -11,7 +11,7 @@
}
#home
#right, #left generalytics, #left etablanalytics, #left loc {
#right, #left generalytics, #left etablanalytics, #left loc, #left #etablanalytics-map-container {
box-shadow: 0px 0px 9px 1px black;
background: #7A90A4;
}
@ -32,9 +32,8 @@
#home
#left
generalytics {
generalytics, #etablanalytics-map-container, loc {
margin-bottom: 1.3vw;
margin-top: 1.3vw;
}
</style>
@ -46,6 +45,7 @@
<div id="left">
<loc />
<generalytics />
<div id="etablanalytics-map-container"></div>
<etablanalytics />
</div>
</div>