maj api+formation+app+main et maj index
This commit is contained in:
+18
-92
@@ -1,97 +1,23 @@
|
||||
// Créer un objet formation à partir des données brutes de l'API
|
||||
export function creerFormation(brut) {
|
||||
export function createFormation(raw) {
|
||||
let taux = 0
|
||||
|
||||
var taux = 0;
|
||||
var latitude = null;
|
||||
var longitude = null;
|
||||
|
||||
if (brut.voe_tot && brut.voe_tot > 0) {
|
||||
taux = Math.round((brut.acc_tot / brut.voe_tot) * 100);
|
||||
}
|
||||
|
||||
if (brut.g_olocalisation_des_formations) {
|
||||
latitude = brut.g_olocalisation_des_formations.lat;
|
||||
longitude = brut.g_olocalisation_des_formations.lon;
|
||||
if (raw.voe_tot && raw.voe_tot > 0) {
|
||||
taux = Math.round((raw.acc_tot / raw.voe_tot) * 100)
|
||||
}
|
||||
|
||||
return {
|
||||
id: brut.cod_uai + "-" + brut.lib_for_voe_ins,
|
||||
|
||||
nom: brut.lib_for_voe_ins,
|
||||
etablissement: brut.g_ea_lib_vx,
|
||||
ville: brut.ville_etab,
|
||||
departement: brut.dep,
|
||||
departementLib: brut.dep_lib,
|
||||
region: brut.region_etab_aff,
|
||||
academie: brut.acad_mies,
|
||||
contrat: brut.contrat_etab,
|
||||
|
||||
filiere: brut.fili,
|
||||
selectivite: brut.select_form,
|
||||
|
||||
capacite: brut.capa_fin,
|
||||
candidats: brut.voe_tot,
|
||||
admis: brut.acc_tot,
|
||||
tauxAcces: taux,
|
||||
|
||||
latitude: latitude,
|
||||
longitude: longitude,
|
||||
|
||||
pctFemmes: brut.pct_f,
|
||||
pctBoursiers: brut.pct_bours,
|
||||
pctNeoBac: brut.pct_neobac,
|
||||
|
||||
pctGeneral: brut.pct_bg,
|
||||
pctTechno: brut.pct_bt,
|
||||
pctPro: brut.pct_bp,
|
||||
|
||||
pctSansMention: brut.pct_sansmention,
|
||||
pctAB: brut.pct_ab,
|
||||
pctB: brut.pct_b,
|
||||
pctTB: brut.pct_tb,
|
||||
pctTBF: brut.pct_tbf,
|
||||
|
||||
pctDebutPhase: brut.pct_acc_debutpp,
|
||||
pctDateBac: brut.pct_acc_datebac,
|
||||
pctFinPhase: brut.pct_acc_finpp,
|
||||
|
||||
admisDebutPhase: brut.acc_debutpp,
|
||||
admisDateBac: brut.acc_datebac,
|
||||
admisFinPhase: brut.acc_finpp,
|
||||
|
||||
// Phase principale
|
||||
voePPGeneral: brut.nb_voe_pp_bg,
|
||||
voePPTechno: brut.nb_voe_pp_bt,
|
||||
voePPPro: brut.nb_voe_pp_bp,
|
||||
voePPAutres: brut.nb_voe_pp_at,
|
||||
voePPTotal: brut.nb_voe_pp,
|
||||
|
||||
classesPPGeneral: brut.nb_cla_pp_bg,
|
||||
classesPPTechno: brut.nb_cla_pp_bt,
|
||||
classesPPPro: brut.nb_cla_pp_bp,
|
||||
classesPPAutres: brut.nb_cla_pp_at,
|
||||
classesPPTotal: brut.nb_cla_pp,
|
||||
|
||||
propositionsPPGeneral: brut.prop_tot_bg,
|
||||
propositionsPPTechno: brut.prop_tot_bt,
|
||||
propositionsPPPro: brut.prop_tot_bp,
|
||||
propositionsPPAutres: brut.prop_tot_at,
|
||||
propositionsPPTotal: brut.prop_tot,
|
||||
|
||||
acceptesPPGeneral: brut.acc_bg,
|
||||
acceptesPPTechno: brut.acc_bt,
|
||||
acceptesPPPro: brut.acc_bp,
|
||||
acceptesPPAutres: brut.acc_at,
|
||||
acceptesPPTotal: brut.acc_pp,
|
||||
|
||||
// Phase complémentaire
|
||||
voePCGeneral: brut.nb_voe_pc_bg,
|
||||
voePCTechno: brut.nb_voe_pc_bt,
|
||||
voePCPro: brut.nb_voe_pc_bp,
|
||||
voePCAutres: brut.nb_voe_pc_at,
|
||||
voePCTotal: brut.nb_voe_pc,
|
||||
|
||||
classesPCTotal: brut.nb_cla_pc,
|
||||
acceptesPCTotal: brut.acc_pc
|
||||
};
|
||||
id: raw.cod_uai + "-" + raw.lib_for_voe_ins,
|
||||
nom: raw.lib_for_voe_ins,
|
||||
etablissement: raw.g_ea_lib_vx,
|
||||
ville: raw.ville_etab,
|
||||
departement: raw.dep,
|
||||
filiere: raw.fili,
|
||||
selectivite: raw.select_form,
|
||||
capacite: raw.capa_fin,
|
||||
candidats: raw.voe_tot,
|
||||
admis: raw.acc_tot,
|
||||
tauxAcces: taux,
|
||||
latitude: raw.g_olocalisation_des_formations ? raw.g_olocalisation_des_formations.lat : null,
|
||||
longitude: raw.g_olocalisation_des_formations ? raw.g_olocalisation_des_formations.lon : null
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user