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

@ -63,22 +63,23 @@ export default class Controller {
log("Selector->Controller", "Requete Section 1")
this.model.getModelData1().then((res) => {
this.view.renderMenu(this.model.getTitle(), res)
this.view.renderPath(this.model.getPath())
})
} else if(n === 2) {
log("Selector->Controller", "Requete Section 2")
this.model.getModelData2().then((res) => {
this.view.renderMenu(this.model.getTitle(), res)
this.view.renderPath(this.model.getPath())
})
} else if(n === 3) {
log("Selector->Controller", "Requete de la liste des etablissements")
this.model.getModelData3().then((res) => {
this.view.renderStat(res)
this.view.renderEtab(res)
this.view.renderPath(this.model.getPath())
})
} else {
log("Selector->Controller", "Numero de page inconnue")
}
this.view.renderPath(this.model.getPath())
}
}

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,6 +50,7 @@ export default class View {
* @param { array[string] } path Chemin courant.
* */
renderPath(path) {
try {
this.path.innerHTML = ""
let elem = document.createElement("locfragment")
@ -64,6 +61,7 @@ export default class View {
this.path.appendChild(elem)
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++
} else {
totselectivity++
}
selectivity += e.fields.taux_acces_ens
totcapacity++
capacity += e.fields.capa_fin
} else {
totselectivity++
}
})
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

View File

@ -31,11 +31,6 @@
max-width: 100%;
}
#generalysticsfragment
#woman, #man, #bacgen, #bacpro, #bactechno, #bacautre, #p, #ab, #b, #tb, #tbf {
padding: 5px;
}
#generalysticsfragment
#generalysticsfragment-gender
#generalysticsfragment-gender-percent
@ -68,15 +63,23 @@
#generalysticsfragment
.generalysticsfragment-legend-container {
display: flex;
flex-direction: column;
flex-direction: row;
justify-content: center;
align-items: center;
gap: 0.7vw;
}
#generalysticsfragment
.generalysticsfragment-legend-square {
width: 40px;
height: 40px;
width: 35px;
height: 35px;
border: 0.102vw solid #344D59;
}
#generalysticsfragment
.generalysticsfragment-percent {
border: 0.102vw solid #344D59;
padding: 0.15vw;
}
#generalysticsfragment
@ -268,10 +271,15 @@
#generalysticsfragment-gen-progress {
width: 15vw;
}
</style>
<div id="generalysticsfragment">
<div id="generalysticsfragment-gen">
<div class="generalysticsfragment-gen-component">
<span class="generalysticsfragment-gen-text">Moyenne des admis</span>
<span class="generalysticsfragment-gen-text">?</span>
</div>
<div class="generalysticsfragment-gen-component">
<span class="generalysticsfragment-gen-text">Nb formations</span>
<span class="generalysticsfragment-gen-text">{ this.props.nformcount }</span>
@ -283,7 +291,7 @@
</div>
<div class="generalysticsfragment-gen-component">
<span class="generalysticsfragment-gen-text">{ `Selectivite (${this.props.selectivitycount})%`}</span>
<span class="generalysticsfragment-gen-text">{ `Selectivite (${this.props.selectivitycount}%)`}</span>
<progress id="generalysticsfragment-gen-progress" max="100" value={ this.props.selectivitycount } />
</div>
</div>
@ -291,11 +299,11 @@
<div id="generalysticsfragment-gender">
<span>Repartition par genre</span>
<div id="generalysticsfragment-gender-percent">
<span style={ this.props.hstyle } id="man">
<span class="generalysticsfragment-percent" style={ this.props.hstyle } id="man">
{ this.props.manPercent } (H)
</span>
<span style={ this.props.fstyle } id="woman">
<span class="generalysticsfragment-percent" style={ this.props.fstyle } id="woman">
{ this.props.womenPercent } (F)
</span>
</div>
@ -316,19 +324,19 @@
<div id="generalysticsfragment-bac">
<span>Repartition par bac</span>
<div id="generalysticsfragment-bac-percent">
<span style={ this.props.autrestyle } id="bacautre">
<span class="generalysticsfragment-percent" style={ this.props.autrestyle } id="bacautre">
{ this.props.nbacautre } (Aut)
</span>
<span style={ this.props.techstyle } id="bactechno">
<span class="generalysticsfragment-percent" style={ this.props.techstyle } id="bactechno">
{ this.props.nbactech } (Tech)
</span>
<span style={ this.props.prostyle } id="bacpro">
<span class="generalysticsfragment-percent" style={ this.props.prostyle } id="bacpro">
{ this.props.nbacpro } (Pro)
</span>
<span style={ this.props.genstyle } id="bacgen">
<span class="generalysticsfragment-percent" style={ this.props.genstyle } id="bacgen">
{ this.props.nbacgen } (Gen)
</span>
</div>
@ -359,23 +367,23 @@
<div id="generalysticsfragment-mention">
<span>Repartition par mention</span>
<div id="generalysticsfragment-mention-percent">
<span style={ this.props.tbfstyle } id="tbf">
<span class="generalysticsfragment-percent" style={ this.props.tbfstyle } id="tbf">
{ this.props.nmentiontbf } (TFB)
</span>
<span style={ this.props.tbstyle } id="tb">
<span class="generalysticsfragment-percent" style={ this.props.tbstyle } id="tb">
{ this.props.nmentiontb } (TB)
</span>
<span style={ this.props.bstyle } id="b">
<span class="generalysticsfragment-percent" style={ this.props.bstyle } id="b">
{ this.props.nmentionb } (B)
</span>
<span style={ this.props.abstyle } id="ab">
<span class="generalysticsfragment-percent" style={ this.props.abstyle } id="ab">
{ this.props.nmentionab } (AB)
</span>
<span style={ this.props.pstyle } id="p">
<span class="generalysticsfragment-percent" style={ this.props.pstyle } id="p">
{ this.props.nmentionp } (P)
</span>
</div>

View File

@ -7,10 +7,14 @@
justify-content: space-between;
font-weight: bold;
list-style-type: none;
width: 100%;
}
#selectorfragment-container
.selectorfragment-name {
display: flex;
justify-content: center;
align-items: center;
text-decoration: none;
color: white;
justify-self: center;
@ -47,7 +51,11 @@
<script>
export default {
props: ["name", "count", "idd"]
props: [
"name",
"count",
"idd"
]
}
</script>
</selectorfragment>