This commit is contained in:
HORVILLE 2023-03-28 16:59:37 +02:00
commit f0e4a79449
4 changed files with 36 additions and 37 deletions

View File

@ -21,11 +21,11 @@
</thead> </thead>
<tbody> <tbody>
<tr each={etablissement in this.state.items}> <tr each={etablissement in this.state.items}>
<td>{etablissement.g_ea_lib_vx}</td> <td>{etablissement.fields.g_ea_lib_vx}</td>
<td>{etablissement.ville_etab}</td> <td>{etablissement.fields.ville_etab}</td>
<td>{etablissement.dep}</td> <td>{etablissement.fields.dep}</td>
<td>{etablissement.list_com}</td> <td>{etablissement.fields.list_com}</td>
<td>{etablissement.taux_acces_ens}</td> <td>{etablissement.fields.taux_acces_ens}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -53,16 +53,17 @@
}) })
console.log(this.state.items) console.log(this.state.items)
this.state.items.forEach(etablissement => { this.state.items.forEach(etablissement => {
// calcul la moyenne // calcul la moyenne
let pct_sansmention = etablissement.fields.pct_sansmention let pct_sansmention = etablissement.fields.pct_sansmention
let pct_AB = etablissement.fields.pct_ab let pct_AB = etablissement.fields.pct_ab
let pct_B = etablissement.fields.pct_b let pct_B = etablissement.fields.pct_b
let pct_TB = etablissement.fields.pct_tb let pct_TB = etablissement.fields.pct_tb
let pct_TBF = etablissement.fields.pct_tbf let pct_TBF = etablissement.fields.pct_tbf
let moyenne = ((pct_TBF*18)+(pct_TB*16)+(pct_B*14)+(pct_AB*12)+(pct_sansmention*10))/100 let moyenne = ((pct_TBF*18)+(pct_TB*16)+(pct_B*14)+(pct_AB*12)+(pct_sansmention*10))/100
etablissement.fields['list_com']=moyenne etablissement.fields['list_com']=moyenne
})
}) })
} }
} }

View File

@ -33,7 +33,7 @@ class PAPI {
static async fetchEtablissement(filiere, sousfiliere, soussousfiliere) { static async fetchEtablissement(filiere, sousfiliere, soussousfiliere) {
let request = await fetch(`${PAPI.searchURL}&refine.fil_lib_voe_acc=${soussousfiliere}&refine.form_lib_voe_acc=${sousfiliere}&refine.fili=${filiere}`) let request = await fetch(`${PAPI.searchURL}&refine.fil_lib_voe_acc=${soussousfiliere}&refine.form_lib_voe_acc=${sousfiliere}&refine.fili=${filiere}`)
let result = await request.json() let result = await request.json()
console.log(result["records"])
return result["records"] return result["records"]
} }
} }

View File

@ -25,7 +25,6 @@ class PAPI {
static async fetchEtablissement(filiere, sousfiliere, soussousfiliere) { static async fetchEtablissement(filiere, sousfiliere, soussousfiliere) {
let request = await fetch(`${PAPI.searchURL}&refine.fil_lib_voe_acc=${soussousfiliere}&refine.form_lib_voe_acc=${sousfiliere}&refine.fili=${filiere}`); let request = await fetch(`${PAPI.searchURL}&refine.fil_lib_voe_acc=${soussousfiliere}&refine.form_lib_voe_acc=${sousfiliere}&refine.fili=${filiere}`);
let result = await request.json(); let result = await request.json();
console.log(result["records"]);
return result["records"]; return result["records"];
} }
} }
@ -63,53 +62,53 @@ var school = {
} }
}; };
}, },
template: (template, expressionTypes, bindingTypes, getComponent) => template('<main class="container"><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><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><tbody><tr expr90="expr90"></tr></tbody></table></main>', [{ template: (template, expressionTypes, bindingTypes, getComponent) => template('<main class="container"><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><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><tbody><tr expr108="expr108"></tr></tbody></table></main>', [{
type: bindingTypes.EACH, type: bindingTypes.EACH,
getKey: null, getKey: null,
condition: null, condition: null,
template: template('<td expr91="expr91"> </td><td expr92="expr92"> </td><td expr93="expr93"> </td><td expr94="expr94"> </td><td expr95="expr95"> </td>', [{ template: template('<td expr109="expr109"> </td><td expr110="expr110"> </td><td expr111="expr111"> </td><td expr112="expr112"> </td><td expr113="expr113"> </td>', [{
redundantAttribute: 'expr91', redundantAttribute: 'expr109',
selector: '[expr91]', selector: '[expr109]',
expressions: [{ expressions: [{
type: expressionTypes.TEXT, type: expressionTypes.TEXT,
childNodeIndex: 0, childNodeIndex: 0,
evaluate: _scope => _scope.etablissement.g_ea_lib_vx evaluate: _scope => _scope.etablissement.fields.g_ea_lib_vx
}] }]
}, { }, {
redundantAttribute: 'expr92', redundantAttribute: 'expr110',
selector: '[expr92]', selector: '[expr110]',
expressions: [{ expressions: [{
type: expressionTypes.TEXT, type: expressionTypes.TEXT,
childNodeIndex: 0, childNodeIndex: 0,
evaluate: _scope => _scope.etablissement.ville_etab evaluate: _scope => _scope.etablissement.fields.ville_etab
}] }]
}, { }, {
redundantAttribute: 'expr93', redundantAttribute: 'expr111',
selector: '[expr93]', selector: '[expr111]',
expressions: [{ expressions: [{
type: expressionTypes.TEXT, type: expressionTypes.TEXT,
childNodeIndex: 0, childNodeIndex: 0,
evaluate: _scope => _scope.etablissement.dep evaluate: _scope => _scope.etablissement.fields.dep
}] }]
}, { }, {
redundantAttribute: 'expr94', redundantAttribute: 'expr112',
selector: '[expr94]', selector: '[expr112]',
expressions: [{ expressions: [{
type: expressionTypes.TEXT, type: expressionTypes.TEXT,
childNodeIndex: 0, childNodeIndex: 0,
evaluate: _scope => _scope.etablissement.list_com evaluate: _scope => _scope.etablissement.fields.list_com
}] }]
}, { }, {
redundantAttribute: 'expr95', redundantAttribute: 'expr113',
selector: '[expr95]', selector: '[expr113]',
expressions: [{ expressions: [{
type: expressionTypes.TEXT, type: expressionTypes.TEXT,
childNodeIndex: 0, childNodeIndex: 0,
evaluate: _scope => _scope.etablissement.taux_acces_ens evaluate: _scope => _scope.etablissement.fields.taux_acces_ens
}] }]
}]), }]),
redundantAttribute: 'expr90', redundantAttribute: 'expr108',
selector: '[expr90]', selector: '[expr108]',
itemName: 'etablissement', itemName: 'etablissement',
indexName: null, indexName: null,
evaluate: _scope => _scope.state.items evaluate: _scope => _scope.state.items

View File

@ -25,7 +25,6 @@ class PAPI {
static async fetchEtablissement(filiere, sousfiliere, soussousfiliere) { static async fetchEtablissement(filiere, sousfiliere, soussousfiliere) {
let request = await fetch(`${PAPI.searchURL}&refine.fil_lib_voe_acc=${soussousfiliere}&refine.form_lib_voe_acc=${sousfiliere}&refine.fili=${filiere}`); let request = await fetch(`${PAPI.searchURL}&refine.fil_lib_voe_acc=${soussousfiliere}&refine.form_lib_voe_acc=${sousfiliere}&refine.fili=${filiere}`);
let result = await request.json(); let result = await request.json();
console.log(result["records"]);
return result["records"]; return result["records"];
} }
} }