ProjetRIOT/components/school.riot

76 lines
3.2 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">
<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>
<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 16:51:44 +02:00
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'
2023-03-29 22:01:50 +02:00
async function fetchEtablissement(formation) {
return PAPI.fetchEtablissement(formation.fili, formation.sousfili, formation.soussousfili);
2023-03-28 16:51:44 +02:00
}
export default function search() {
2023-03-28 16:51:44 +02:00
return {
onBeforeMount(props, state) {
this.state = {
items: null,
2023-03-29 22:01:50 +02:00
formation: this.props.formation
2023-03-28 16:51:44 +02:00
}
2023-03-29 22:01:50 +02:00
fetchEtablissement(this.state.formation).then((response) => {
2023-03-28 16:51:44 +02:00
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>