This commit is contained in:
pro.boooooo
2023-03-11 15:44:29 +01:00
parent 73429d7439
commit f3a75faf1b
4 changed files with 69 additions and 48 deletions

View File

@@ -18,10 +18,6 @@ export default class View {
/**
* Contruction de la balise <li> qui vas se loger dans le menu.
* <li>
* <a>Tous les noms des formations par section</a>
* <span>Combien de formations dispo ?</span>
* </li>
* @param { array[json] } data Donnees a afficher.
* @param { string } title Titre de la section d'un menu.
* */
@@ -54,16 +50,18 @@ export default class View {
* @param { array[string] } path Chemin courant.
* */
renderPath(path) {
this.path.innerHTML = ""
let elem = document.createElement("locfragment")
try {
this.path.innerHTML = ""
let elem = document.createElement("locfragment")
riot.mount(elem, {
msg: path.filter(Boolean).join(" ► ")
}, "locfragment")
riot.mount(elem, {
msg: path.filter(Boolean).join(" ► ")
}, "locfragment")
this.path.appendChild(elem)
this.path.appendChild(elem)
log("Loc->View", `Chemin change ${path}`)
log("Loc->View", `Chemin change ${path}`)
} catch(e) {}
}
/**
@@ -82,10 +80,10 @@ export default class View {
data.forEach((e) => {
let etab = e.fields.g_ea_lib_vx
let dept = e.fields.dep
let dept = `${e.fields.dep_lib} (${e.fields.dep})`
let city = e.fields.ville_etab
let moy = "null"
let selection = "null"
let moy = "?"
let selection = e.fields.taux_acces_ens
/**
* TODO: Transformer ca en composant riot (GALERE MAX)
@@ -105,7 +103,16 @@ export default class View {
td4.innerText = moy
let td5 = document.createElement("td")
td5.innerText = selection
td5.innerText = `(${selection}%)`
td5.style.display = "flex"
td5.style.justifyContent = "center"
td5.style.alignItems = "center"
td5.style.gap = "1.3vw"
let progresstd5 = document.createElement("progress")
progresstd5.setAttribute("max", "100")
progresstd5.setAttribute("value", `${selection}`)
td5.appendChild(progresstd5)
tr.appendChild(td1)
tr.appendChild(td2)
@@ -141,25 +148,21 @@ export default class View {
let selectivity = 0
data.forEach((e) => {
console.log(e.fields.select_form)
if(e.fields.select_form === "formation sélective") {
if(e.fields.taux_acces_ens >= 0) {
totselectivity++
selectivity++
selectivity += e.fields.taux_acces_ens
totcapacity++
capacity += e.fields.capa_fin
} else {
totselectivity++
}
totcapacity++
capacity += e.fields.capa_fin
})
let moyform = nbformation
let moycap = Math.round(capacity / totcapacity)
let moyselectivity = Math.round(selectivity / totselectivity)
console.log(capacity + " " + totcapacity +"\n" + selectivity + " " + totselectivity)
console.log(moyform + "\n" + moycap + "\n" + moyselectivity)
return {
capacitycount: moycap,
nformcount: moyform,
@@ -241,6 +244,7 @@ export default class View {
b += e.fields.acc_b
tb += e.fields.acc_tb
tbf += e.fields.acc_tbf
console.log(e.fields.lien_form_sup)
})
let tot = p + ab + b + tb + tbf