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") log("Selector->Controller", "Requete Section 1")
this.model.getModelData1().then((res) => { this.model.getModelData1().then((res) => {
this.view.renderMenu(this.model.getTitle(), res) this.view.renderMenu(this.model.getTitle(), res)
this.view.renderPath(this.model.getPath())
}) })
} else if(n === 2) { } else if(n === 2) {
log("Selector->Controller", "Requete Section 2") log("Selector->Controller", "Requete Section 2")
this.model.getModelData2().then((res) => { this.model.getModelData2().then((res) => {
this.view.renderMenu(this.model.getTitle(), res) this.view.renderMenu(this.model.getTitle(), res)
this.view.renderPath(this.model.getPath())
}) })
} else if(n === 3) { } else if(n === 3) {
log("Selector->Controller", "Requete de la liste des etablissements") log("Selector->Controller", "Requete de la liste des etablissements")
this.model.getModelData3().then((res) => { this.model.getModelData3().then((res) => {
this.view.renderStat(res) this.view.renderStat(res)
this.view.renderEtab(res) this.view.renderEtab(res)
this.view.renderPath(this.model.getPath())
}) })
} else { } else {
log("Selector->Controller", "Numero de page inconnue") 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. * 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 { array[json] } data Donnees a afficher.
* @param { string } title Titre de la section d'un menu. * @param { string } title Titre de la section d'un menu.
* */ * */
@ -54,16 +50,18 @@ export default class View {
* @param { array[string] } path Chemin courant. * @param { array[string] } path Chemin courant.
* */ * */
renderPath(path) { renderPath(path) {
this.path.innerHTML = "" try {
let elem = document.createElement("locfragment") this.path.innerHTML = ""
let elem = document.createElement("locfragment")
riot.mount(elem, { riot.mount(elem, {
msg: path.filter(Boolean).join(" ► ") msg: path.filter(Boolean).join(" ► ")
}, "locfragment") }, "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) => { data.forEach((e) => {
let etab = e.fields.g_ea_lib_vx 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 city = e.fields.ville_etab
let moy = "null" let moy = "?"
let selection = "null" let selection = e.fields.taux_acces_ens
/** /**
* TODO: Transformer ca en composant riot (GALERE MAX) * TODO: Transformer ca en composant riot (GALERE MAX)
@ -105,7 +103,16 @@ export default class View {
td4.innerText = moy td4.innerText = moy
let td5 = document.createElement("td") 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(td1)
tr.appendChild(td2) tr.appendChild(td2)
@ -141,25 +148,21 @@ export default class View {
let selectivity = 0 let selectivity = 0
data.forEach((e) => { data.forEach((e) => {
console.log(e.fields.select_form) if(e.fields.taux_acces_ens >= 0) {
if(e.fields.select_form === "formation sélective") {
totselectivity++ totselectivity++
selectivity++ selectivity += e.fields.taux_acces_ens
totcapacity++
capacity += e.fields.capa_fin
} else { } else {
totselectivity++ totselectivity++
} }
totcapacity++
capacity += e.fields.capa_fin
}) })
let moyform = nbformation let moyform = nbformation
let moycap = Math.round(capacity / totcapacity) let moycap = Math.round(capacity / totcapacity)
let moyselectivity = Math.round(selectivity / totselectivity) let moyselectivity = Math.round(selectivity / totselectivity)
console.log(capacity + " " + totcapacity +"\n" + selectivity + " " + totselectivity)
console.log(moyform + "\n" + moycap + "\n" + moyselectivity)
return { return {
capacitycount: moycap, capacitycount: moycap,
nformcount: moyform, nformcount: moyform,
@ -241,6 +244,7 @@ export default class View {
b += e.fields.acc_b b += e.fields.acc_b
tb += e.fields.acc_tb tb += e.fields.acc_tb
tbf += e.fields.acc_tbf tbf += e.fields.acc_tbf
console.log(e.fields.lien_form_sup)
}) })
let tot = p + ab + b + tb + tbf let tot = p + ab + b + tb + tbf

View File

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

View File

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