ProjetRIOT/components/school.riot

74 lines
3.1 KiB
Plaintext
Raw Normal View History

2023-03-28 10:15:32 +02:00
<school>
2023-03-30 00:54:13 +02:00
<div if={props.shouldShowInfos} 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>
2023-03-30 00:54:13 +02:00
<tr if={!state.loading} each={etablissement in 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-30 00:54:13 +02:00
async function fetchEtablissement(course) {
return PAPI.fetchEtablissement(course.fili, course.sousfili, course.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) {
2023-03-30 00:54:13 +02:00
state = {
items: null
2023-03-28 16:51:44 +02:00
}
2023-03-30 00:54:13 +02:00
},
onUpdated(props, state) {
if (!props.shouldShowInfos) return
fetchEtablissement(props.course).then((response) => {
response.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.
2023-03-30 00:54:13 +02:00
etablissement.fields.moyenne = ((pct_TBF*19)+(pct_TB*17)+(pct_B*15)+(pct_AB*13)+(pct_sansmention*11))/100
})
this.update({
items: response
2023-03-28 16:54:41 +02:00
})
2023-03-28 16:51:44 +02:00
})
}
2023-03-28 10:15:32 +02:00
}
}
</script>
</school>