ProjetRIOT/components/school.riot

77 lines
3.3 KiB
Plaintext
Raw Normal View History

2023-03-28 10:15:32 +02:00
<school>
2023-03-29 16:50:48 +02:00
<div class="box p-2 m-2">
2023-03-29 22:56:14 +02:00
<iframe width="100%" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"
src="https://www.openstreetmap.org/export/embed.html?bbox=-14.655761718750002%2C40.56389453066509%2C13.601074218750002%2C51.754240074033525&amp;layer=mapnik"
style="border-radius: 5px;"></iframe>
2023-03-29 16:50:48 +02:00
<br>
<div class="block control has-icons-left is-inline-block is-pulled-right">
<input class="input" type="search" placeholder="Établissement">
<span class="icon is-small is-left">
<i class="fas fa-search"></i>
</span>
</div>
2023-03-28 10:15:32 +02:00
<table class="table is-fullwidth is-hoverable">
<thead>
<tr>
<th><abbr title="name">Nom</abbr></th>
<th><abbr title="city">Ville</abbr></th>
<th><abbr title="dept">Dpt</abbr></th>
<th><abbr title="moyenne">Moyenne</abbr></th>
<th><abbr title="selectivite">Sélectivité</abbr></th>
</tr>
</thead>
2023-03-28 16:51:44 +02:00
<tbody>
<tr each={etablissement in this.state.items}>
<td>{etablissement.fields.g_ea_lib_vx}</td>
<td>{etablissement.fields.ville_etab}</td>
<td>{etablissement.fields.dep}</td>
2023-03-28 21:30:56 +02:00
<td>{etablissement.fields.moyenne}</td>
<td>{etablissement.fields.taux_acces_ens}</td>
2023-03-28 16:51:44 +02:00
</tr>
</tbody>
</table>
2023-03-29 16:50:48 +02:00
</div>
2023-03-28 16:51:44 +02:00
2023-03-28 10:15:32 +02:00
<script>
2023-03-28 16:51:44 +02:00
import PAPI from '../javascript/parcoursup-link.js'
async function fetchEtablissement(state) {
return PAPI.fetchEtablissement(state.fili, state.sousfili, state.soussousfili);
}
export default function search() {
2023-03-28 16:51:44 +02:00
return {
onBeforeMount(props, state) {
this.state = {
items: null,
fili: "BUT",
sousfili: "BUT - Production",
soussousfili : "Informatique"
}
fetchEtablissement(this.state).then((response) => {
this.update({
items: response
})
2023-03-29 16:50:48 +02:00
//console.log(this.state.items)
2023-03-28 16:51:44 +02:00
this.state.items.forEach(etablissement => {
2023-03-28 16:54:41 +02:00
// calcul la moyenne
let pct_sansmention = etablissement.fields.pct_sansmention
let pct_AB = etablissement.fields.pct_ab
let pct_B = etablissement.fields.pct_b
let pct_TB = etablissement.fields.pct_tb
let pct_TBF = etablissement.fields.pct_tbf
2023-03-29 16:50:48 +02:00
// On prend la moyenne des moyennes comprises dans la mention
// Exemple : Assez bien est entre 12 et 14 donc 13.
let moyenne = ((pct_TBF*19)+(pct_TB*17)+(pct_B*15)+(pct_AB*13)+(pct_sansmention*11))/100
2023-03-28 16:54:41 +02:00
2023-03-28 21:30:56 +02:00
etablissement.fields.moyenne=moyenne
2023-03-29 16:50:48 +02:00
//console.log(etablissement.fields)
2023-03-28 16:54:41 +02:00
})
2023-03-28 21:30:56 +02:00
this.update()
2023-03-28 16:51:44 +02:00
})
}
2023-03-28 10:15:32 +02:00
}
}
</script>
</school>