simulation.wikibac.fr/BFI/calcul.js
2023-07-15 17:03:08 +02:00

243 lines
9.9 KiB
JavaScript
Executable File

function update() {
/* ------------- Contrôle continu ------------- */
let total_CC = 0;
// EMC
let note_emc_1re = document.getElementById("note-emc-1re").value;
let points_emc_1re = 1 * note_emc_1re
document.getElementById("points-emc-1re").innerHTML = points_emc_1re.toLocaleString("fr");
total_CC += points_emc_1re;
let note_emc_tle = document.getElementById("note-emc-tle").value;
let points_emc_tle = 1 * note_emc_tle
document.getElementById("points-emc-tle").innerHTML = points_emc_tle.toLocaleString("fr");
total_CC += points_emc_tle;
// LVB
let note_lvb_1re = document.getElementById("note-lvb-1re").value;
let points_lvb_1re = 3 * note_lvb_1re
document.getElementById("points-lvb-1re").innerHTML = points_lvb_1re.toLocaleString("fr");
total_CC += points_lvb_1re;
let note_lvb_tle = document.getElementById("note-lvb-tle").value;
let points_lvb_tle = 3 * note_lvb_tle
document.getElementById("points-lvb-tle").innerHTML = points_lvb_tle.toLocaleString("fr");
total_CC += points_lvb_tle;
// ES
let note_es_1re = document.getElementById("note-es-1re").value;
let points_es_1re = 3 * note_es_1re
document.getElementById("points-es-1re").innerHTML = points_es_1re.toLocaleString("fr");
total_CC += points_es_1re;
let note_es_tle = document.getElementById("note-es-tle").value;
let points_es_tle = 3 * note_es_tle
document.getElementById("points-es-tle").innerHTML = points_es_tle.toLocaleString("fr");
total_CC += points_es_tle;
// EPS
let note_eps_tle = document.getElementById("note-eps-tle").value;
let points_eps_tle = 6 * note_eps_tle
document.getElementById("points-eps-tle").innerHTML = points_eps_tle.toLocaleString("fr");
total_CC += points_eps_tle;
// Spé 3
let note_spe3_1re = document.getElementById("note-spe3-1re").value;
let points_spe3_1re = 8 * note_spe3_1re
document.getElementById("points-spe3-1re").innerHTML = points_spe3_1re.toLocaleString("fr");
total_CC += points_spe3_1re;
document.getElementById("total-points-CC").innerHTML = total_CC.toLocaleString("fr")
/* ------------- Épreuves terminales ------------- */
let total_terminal = 0;
// Français écrit
let note_fr_ecrit = document.getElementById("note-fr-ecrit").value;
let points_fr_ecrit = 5 * note_fr_ecrit
document.getElementById("points-fr-ecrit").innerHTML = points_fr_ecrit.toLocaleString("fr");
total_terminal += points_fr_ecrit;
// Français oral
let note_fr_oral = document.getElementById("note-fr-oral").value;
let points_fr_oral = 5 * note_fr_oral
document.getElementById("points-fr-oral").innerHTML = points_fr_oral.toLocaleString("fr");
total_terminal += points_fr_oral;
// Philosophie
let note_philo = document.getElementById("note-philo").value;
let points_philo = 8 * note_philo
document.getElementById("points-philo").innerHTML = points_philo.toLocaleString("fr");
total_terminal += points_philo;
// Grand oral
let note_go = document.getElementById("note-go").value;
let points_go = 10 * note_go
document.getElementById("points-go").innerHTML = points_go.toLocaleString("fr");
total_terminal += points_go;
// Spé 1
let note_spe1 = document.getElementById("note-spe1").value;
let points_spe1 = 16 * note_spe1
document.getElementById("points-spe1").innerHTML = points_spe1.toLocaleString("fr");
total_terminal += points_spe1;
// Spé 2
let note_spe2 = document.getElementById("note-spe2").value;
let points_spe2 = 16 * note_spe2
document.getElementById("points-spe2").innerHTML = points_spe2.toLocaleString("fr");
total_terminal += points_spe2;
document.getElementById("total-points-terminal").innerHTML = total_terminal.toLocaleString("fr")
/* ------------- Épreuves spécifiques ------------- */
let total_specifique = 0;
// ACL écrit
let note_acl_ecrit = document.getElementById("note-acl-ecrit").value;
let points_acl_ecrit = 10 * note_acl_ecrit
document.getElementById("points-acl-ecrit").innerHTML = points_acl_ecrit.toLocaleString("fr");
total_specifique += points_acl_ecrit;
// ACL oral
let note_acl_oral = document.getElementById("note-acl-oral").value;
let points_acl_oral = 10 * note_acl_oral
document.getElementById("points-acl-oral").innerHTML = points_acl_oral.toLocaleString("fr");
total_specifique += points_acl_oral;
// HG écrit
let note_hg_ecrit = document.getElementById("note-hg-ecrit").value;
let points_hg_ecrit = 10 * note_hg_ecrit
document.getElementById("points-hg-ecrit").innerHTML = points_hg_ecrit.toLocaleString("fr");
total_specifique += points_hg_ecrit;
// HG oral
let note_hg_oral = document.getElementById("note-hg-oral").value;
let points_hg_oral = 10 * note_hg_oral
document.getElementById("points-hg-oral").innerHTML = points_hg_oral.toLocaleString("fr");
total_specifique += points_hg_oral;
// CDM
let note_cdm = document.getElementById("note-cdm").value;
let points_cdm = 20 * note_cdm
document.getElementById("points-cdm").innerHTML = points_cdm.toLocaleString("fr");
total_specifique += points_cdm;
document.getElementById("total-points-specifique").innerHTML = total_specifique.toLocaleString("fr")
/* ------------- Options ------------- */
let total_options = 0;
let coef_options = 0;
if (document.getElementById("check-lca-1re").checked) {
document.getElementById("coef-lca-1re").innerHTML = "2";
coef_options += 2;
let points_lca_1re = 2*document.getElementById("note-lca-1re").value;
total_options += points_lca_1re;
document.getElementById("points-lca-1re").innerHTML = points_lca_1re.toLocaleString("fr");
} else {
document.getElementById("coef-lca-1re").innerHTML = "<del>2</del>";
document.getElementById("points-lca-1re").innerHTML = "0";
}
if (document.getElementById("check-lca-tle").checked) {
document.getElementById("coef-lca-tle").innerHTML = "2";
coef_options += 2;
let points_lca_tle = 2*document.getElementById("note-lca-tle").value;
total_options += points_lca_tle;
document.getElementById("points-lca-tle").innerHTML = points_lca_tle.toLocaleString("fr");
} else {
document.getElementById("coef-lca-tle").innerHTML = "<del>2</del>";
document.getElementById("points-lca-tle").innerHTML = "0";
}
if (document.getElementById("check-opt1-1re").checked) {
document.getElementById("coef-opt1-1re").innerHTML = "2";
coef_options += 2;
let points_opt1_1re = 2*document.getElementById("note-opt1-1re").value;
total_options += points_opt1_1re;
document.getElementById("points-opt1-1re").innerHTML = points_opt1_1re.toLocaleString("fr");
} else {
document.getElementById("coef-opt1-1re").innerHTML = "<del>2</del>";
document.getElementById("points-opt1-1re").innerHTML = "0";
}
if (document.getElementById("check-opt1-tle").checked) {
document.getElementById("coef-opt1-tle").innerHTML = "2";
coef_options += 2;
let points_opt1_tle = 2*document.getElementById("note-opt1-tle").value;
total_options += points_opt1_tle;
document.getElementById("points-opt1-tle").innerHTML = points_opt1_tle.toLocaleString("fr");
} else {
document.getElementById("coef-opt1-tle").innerHTML = "<del>2</del>";
document.getElementById("points-opt1-tle").innerHTML = "0";
}
if (document.getElementById("check-opt2").checked) {
document.getElementById("coef-opt2").innerHTML = "2";
coef_options += 2;
let points_opt2 = 2*document.getElementById("note-opt2").value;
total_options += points_opt2;
document.getElementById("points-opt2").innerHTML = points_opt2.toLocaleString("fr");
} else {
document.getElementById("coef-opt2").innerHTML = "<del>2</del>";
document.getElementById("points-opt2").innerHTML = "0";
}
document.getElementById("total-coef-options").innerHTML = coef_options.toLocaleString("fr");
document.getElementById("total-points-options").innerHTML = total_options.toLocaleString("fr");
// CALCUL
let total_points = total_CC + total_terminal + total_specifique + total_options;
document.getElementById("total-points").innerHTML = total_points.toLocaleString("fr");
let total_coef = 148 + coef_options;
document.getElementById("total-coef").innerHTML = total_coef.toLocaleString("fr");
let note_brute = total_points/total_coef;
let note_finale = Math.ceil(100*note_brute)/100;
document.getElementById("note-finale").innerHTML = note_finale.toLocaleString("fr");
let decision;
let sup_mention_actuelle;
if (note_finale < 8) {
decision = "Ajourné"
sup_mention_actuelle = 7.99*total_coef
} else if (note_finale < 10) {
decision = "Passe le second groupe";
sup_mention_actuelle = 9.99*total_coef
} else if (note_finale < 12) {
decision = "Admis";
sup_mention_actuelle = 11.99*total_coef
} else if (note_finale < 14) {
decision = "Admis Mention Assez Bien";
sup_mention_actuelle = 13.99*total_coef
} else if (note_finale < 16) {
decision = "Admis Mention Bien";
sup_mention_actuelle = 15.99*total_coef
} else if (note_finale < 18) {
decision = "Admis Mention Très Bien";
sup_mention_actuelle = 17.99*total_coef
} else {
decision = "Admis Mention Très Bien avec les félicitations du jury";
sup_mention_actuelle = NaN
}
if (note_finale < 18) {
let points_mention_suivante = Math.ceil(10*(sup_mention_actuelle - total_points + .01))/10
document.getElementById("points-manquants").innerHTML = points_mention_suivante.toLocaleString("fr");
} else {
document.getElementById("points-manquants").innerHTML = "-";
}
document.getElementById("decision-jury").innerHTML = decision;
}