merge
This commit is contained in:
@@ -51,7 +51,6 @@
|
||||
state.selectivity = Math.floor(avgSlc)
|
||||
|
||||
let pctFemmes = Math.round(list.reduce((s, e) => s + (e.fields.pct_f || 0), 0) / list.filter((e) => e.fields.pct_f).length)
|
||||
console.log(pctFemmes)
|
||||
state.genreStats = [
|
||||
{
|
||||
name: "Hommes",
|
||||
|
@@ -1,15 +1,15 @@
|
||||
<main-controller>
|
||||
<div class="columns">
|
||||
<div class="column is-one-third">
|
||||
<div class="box p-3 m-2">
|
||||
<img class="mt-1 ml-5 mr-auto" style="margin: auto;" src="./resources/logo-parcoursup.svg"/>
|
||||
<div class="box p-3 m-2" style="display: flex">
|
||||
<img class="m-auto" src="./resources/logo-parcoursup.svg"/>
|
||||
</div>
|
||||
<search updateCourse={updateCourse}></search>
|
||||
</div>
|
||||
|
||||
<div class="column">
|
||||
<fili-info schoolList={state.schoolList} course={state.course} shouldShowInfos={state.shouldShowInfos}></fili-info>
|
||||
<school popup={popup} sortList={sortList} schoolList={state.filteredSchoolList} sortFields={state.sortFields} course={state.course} shouldShowInfos={state.shouldShowInfos}></school>
|
||||
<school popup={popup} schoolList={state.schoolList} schoolListUpdating={state.schoolListUpdating} course={state.course} shouldShowInfos={state.shouldShowInfos}></school>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -19,45 +19,16 @@
|
||||
|
||||
import PAPI from '../javascript/parcoursup-link.js'
|
||||
|
||||
const SORT_TABLE = [
|
||||
{name: "Nom", id: "g_ea_lib_vx"},
|
||||
{name: "Ville", id: "ville_etab"},
|
||||
{name: "Département", id: "dep"},
|
||||
{name: "Moyenne", id: "moyenne"},
|
||||
{name: "Sélectivité", id: "taux_acces_ens"}
|
||||
]
|
||||
|
||||
export default {
|
||||
sortList(sortBy) {
|
||||
//Si la liste est déjà triée par la bonne catégorie, on l'inverse
|
||||
if (sortBy == this.state.sortBy) {
|
||||
this.state.filteredSchoolList.reverse()
|
||||
}
|
||||
//Sinon on l'ordonne par la nouvelle catégorie (ascendant par défaut)
|
||||
else {
|
||||
this.state.sortBy = sortBy
|
||||
updateCourse(course){
|
||||
this.updateList(course)
|
||||
|
||||
switch (sortBy) {
|
||||
case SORT_TABLE[3].id:
|
||||
case SORT_TABLE[4].id: {
|
||||
this.state.filteredSchoolList.sort((a, b) => {
|
||||
if (a.fields[sortBy] > b.fields[sortBy]) return 1
|
||||
else return -1
|
||||
})
|
||||
break
|
||||
}
|
||||
|
||||
default: {
|
||||
this.state.filteredSchoolList.sort((a, b) => {
|
||||
return (a.fields[sortBy]).localeCompare(b.fields[sortBy])
|
||||
})
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.update()
|
||||
this.update({
|
||||
course: course,
|
||||
shouldShowInfos: course != null,
|
||||
})
|
||||
},
|
||||
|
||||
updateList(course) {
|
||||
course = course || this.state.course
|
||||
PAPI.fetchEtablissement(course.fili, course.sousfili, course.soussousfili).then((response) => {
|
||||
@@ -72,27 +43,23 @@
|
||||
// On prend la moyenne des moyennes comprises dans la mention
|
||||
// Exemple : Assez bien est entre 12 et 14 donc 13.
|
||||
etablissement.fields.moyenne = ((pct_TBF*19)+(pct_TB*17)+(pct_B*15)+(pct_AB*13)+(pct_sansmention*11))/100
|
||||
})
|
||||
})
|
||||
|
||||
this.update({
|
||||
schoolListUpdating: true,
|
||||
schoolList: response
|
||||
})
|
||||
|
||||
this.update({
|
||||
schoolList: response
|
||||
})
|
||||
this.filterSearch()
|
||||
})
|
||||
},
|
||||
updateCourse(course){
|
||||
this.updateList(course)
|
||||
|
||||
this.update({
|
||||
course: course,
|
||||
sortFields: SORT_TABLE,
|
||||
shouldShowInfos: course != null,
|
||||
schoolListUpdating: false
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
onMounted(props, state) {
|
||||
this.update({
|
||||
course: null,
|
||||
<<<<<<< HEAD
|
||||
sortBy: null,
|
||||
schoolList: null,
|
||||
sortFields: SORT_TABLE,
|
||||
@@ -133,6 +100,11 @@
|
||||
popupEnabled: false
|
||||
})
|
||||
console.log("closed!")
|
||||
=======
|
||||
schoolList: [],
|
||||
shouldShowInfos: false
|
||||
})
|
||||
>>>>>>> 6ed22586179f7de1d23fd1ebd68d111298170226
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@@ -3,9 +3,8 @@
|
||||
<iframe if={false} 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&layer=mapnik"
|
||||
style="border-radius: 5px;"></iframe>
|
||||
<br>
|
||||
<div class="block control has-icons-left is-inline-block is-pulled-right">
|
||||
<input class="input" onkeyup={props.filterSearch} type="search" placeholder="Établissement">
|
||||
<input class="input" onkeyup={filterSearch} type="search" placeholder="Établissement">
|
||||
<span class="icon is-small is-left">
|
||||
<i class="fas fa-search"></i>
|
||||
</span>
|
||||
@@ -13,16 +12,16 @@
|
||||
<table class="table is-fullwidth is-hoverable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th each={sortField in props.sortFields}>
|
||||
<th each={sortField in sortFields}>
|
||||
{sortField.name}
|
||||
<a id={sortField.id} onclick={() => props.sortList(sortField.id)}>
|
||||
<a id={sortField.id} onclick={() => sortList(sortField.id, true)}>
|
||||
<span class="icon"><i class="fas fa-sort"></i></span>
|
||||
</a>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr each={school in props.schoolList}>
|
||||
<tr each={school in state.filteredSchoolList}>
|
||||
<td><a onclick={() => props.popup(school)}>{school.fields.g_ea_lib_vx}</a></td>
|
||||
<td>{school.fields.ville_etab}</td>
|
||||
<td>{school.fields.dep}</td>
|
||||
@@ -32,4 +31,87 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
const SORT_TABLE = [
|
||||
{name: "Nom", id: "g_ea_lib_vx"},
|
||||
{name: "Ville", id: "ville_etab"},
|
||||
{name: "Département", id: "dep"},
|
||||
{name: "Moyenne", id: "moyenne"},
|
||||
{name: "Sélectivité", id: "taux_acces_ens"}
|
||||
]
|
||||
|
||||
export default {
|
||||
filterSearch() {
|
||||
let input = this.$("input")
|
||||
if (!input) return
|
||||
|
||||
let finalArray = []
|
||||
|
||||
//On évite de trier avant d'avoir plus de 1 lettres.
|
||||
if (input.value.length > 1) {
|
||||
finalArray = this.state.schoolList.filter((item) => {
|
||||
return item.fields.g_ea_lib_vx.toLowerCase().includes(input.value.toLowerCase())
|
||||
})
|
||||
} else {
|
||||
finalArray = this.state.schoolList
|
||||
}
|
||||
|
||||
this.update({
|
||||
filteredSchoolList: finalArray
|
||||
})
|
||||
},
|
||||
|
||||
sortList(sortBy, shouldUpdate) {
|
||||
//Si la liste est déjà triée par la bonne catégorie, on l'inverse
|
||||
if (sortBy == this.state.sortBy) {
|
||||
this.state.filteredSchoolList.reverse()
|
||||
}
|
||||
|
||||
//Sinon on l'ordonne par la nouvelle catégorie (ascendant par défaut)
|
||||
else {
|
||||
this.state.sortBy = sortBy
|
||||
|
||||
switch (sortBy) {
|
||||
case SORT_TABLE[3].id:
|
||||
case SORT_TABLE[4].id: {
|
||||
this.state.filteredSchoolList.sort((a, b) => {
|
||||
if (a.fields[sortBy] > b.fields[sortBy]) return 1
|
||||
else return -1
|
||||
})
|
||||
break
|
||||
}
|
||||
|
||||
default: {
|
||||
this.state.filteredSchoolList.sort((a, b) => {
|
||||
return (a.fields[sortBy]).localeCompare(b.fields[sortBy])
|
||||
})
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.update()
|
||||
},
|
||||
|
||||
onBeforeUpdate(props, state) {
|
||||
if (props.schoolListUpdating) {
|
||||
state.schoolList = [...props.schoolList]
|
||||
state.filteredSchoolList = [...state.schoolList]
|
||||
if (this.$("input")) this.$("input").value = ""
|
||||
}
|
||||
},
|
||||
|
||||
onBeforeMount(props, state) {
|
||||
this.state = {
|
||||
sortBy: null,
|
||||
schoolList: [],
|
||||
filteredSchoolList: []
|
||||
}
|
||||
},
|
||||
|
||||
sortFields: SORT_TABLE
|
||||
}
|
||||
</script>
|
||||
</school>
|
@@ -9,11 +9,11 @@
|
||||
<script>
|
||||
const DEFAULT_CLASSES = "progress is-small m-2 mt-auto mb-auto"
|
||||
const COLOR_CLASSES = [
|
||||
"is-link",
|
||||
"is-info",
|
||||
"is-success",
|
||||
"is-danger",
|
||||
"is-warning",
|
||||
"is-danger"
|
||||
"is-success",
|
||||
"is-info",
|
||||
"is-link"
|
||||
]
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user