forked from ScoDoc/ScoDoc
Bulletins: ajuste l affichage de la ligne module pour les modules malus (contrib. JMP)
This commit is contained in:
parent
d6bf8efdee
commit
97f69ebc7d
@ -435,8 +435,15 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers
|
||||
if mod["mod_moy_txt"][:2] == "NA":
|
||||
mod["mod_moy_txt"] = "-"
|
||||
if is_malus:
|
||||
mod["mod_moy_txt"] = ""
|
||||
mod["mod_coef_txt"] = ""
|
||||
if mod_moy > 0:
|
||||
mod["mod_moy_txt"] = fmt_note(mod_moy)
|
||||
mod["mod_coef_txt"] = "Malus"
|
||||
elif mod_moy < 0:
|
||||
mod["mod_moy_txt"] = fmt_note(-mod_moy)
|
||||
mod["mod_coef_txt"] = "Bonus"
|
||||
else:
|
||||
mod["mod_moy_txt"] = "-"
|
||||
mod["mod_coef_txt"] = "-"
|
||||
else:
|
||||
mod["mod_coef_txt"] = fmt_coef(modimpl["module"]["coefficient"])
|
||||
if mod["mod_moy_txt"] != "NI": # ne montre pas les modules 'non inscrit'
|
||||
|
68
scotests/test_bonusmalus.py
Normal file
68
scotests/test_bonusmalus.py
Normal file
@ -0,0 +1,68 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""Test notes bonus/malus
|
||||
|
||||
Création 10 étudiants, puis formation en 4 semestre.
|
||||
Le premier étudiant redouble sa deuxième année.
|
||||
|
||||
Utiliser comme:
|
||||
scotests/scointeractive.sh -r TEST00 scotests/test_bonusmalus.py
|
||||
|
||||
"""
|
||||
|
||||
|
||||
import scotests.sco_fake_gen as sco_fake_gen # pylint: disable=import-error
|
||||
import sco_utils as scu
|
||||
|
||||
G = sco_fake_gen.ScoFake(context.Notes) # pylint: disable=undefined-variable
|
||||
G.verbose = False
|
||||
|
||||
# --- Création d'étudiants
|
||||
etuds = [G.create_etud(code_nip=None) for _ in range(10)]
|
||||
|
||||
# --- Mise en place formation 1 semestre
|
||||
f, ue_list, mod_list = G.setup_formation(nb_semestre=1)
|
||||
|
||||
# --- Ajoute module malus à la premiere matiere de la première UE
|
||||
mod_malus = G.create_module(
|
||||
titre="MALUS",
|
||||
code="MAL",
|
||||
coefficient=10,
|
||||
ue_id=ue_list[0]["ue_id"],
|
||||
matiere_id=mod_list[0]["matiere_id"],
|
||||
formation_id=f["formation_id"],
|
||||
semestre_id=1,
|
||||
module_type=scu.MODULE_MALUS,
|
||||
)
|
||||
mod_list.append(mod_malus)
|
||||
|
||||
# --- Crée le semestre
|
||||
|
||||
semestre_id, date_debut, date_fin = (1, "01/09/2019", "15/01/2020")
|
||||
sem, eval_list = G.setup_formsemestre(
|
||||
f, mod_list, semestre_id=semestre_id, date_debut=date_debut, date_fin=date_fin
|
||||
)
|
||||
|
||||
# --- Recupère le module de malus
|
||||
modimpls = context.Notes.do_moduleimpl_list(formsemestre_id=sem["formsemestre_id"])
|
||||
# de façon tout à fait inefficace ;-)
|
||||
moduleimpl_malus = [m for m in modimpls if m["module_id"] == mod_malus["module_id"]][0]
|
||||
# et l'évaluation de malus, de la même façon:
|
||||
eval_malus = [
|
||||
e for e in eval_list if e["moduleimpl_id"] == moduleimpl_malus["moduleimpl_id"]
|
||||
][0]
|
||||
eval_normales = [
|
||||
e for e in eval_list if e["moduleimpl_id"] != moduleimpl_malus["moduleimpl_id"]
|
||||
]
|
||||
|
||||
# --- Affect des malus entre -10 et +10
|
||||
n = len(etuds)
|
||||
malus = [((x / (n - 1.0)) * 20) - 10 for x in range(n)]
|
||||
for etud, note in zip(etuds, malus):
|
||||
G.create_note(evaluation=e, etud=etud, note=note)
|
||||
|
||||
# --- Inscrit les étudiants et affecte des notes aléatoires aux évaluations normales
|
||||
for etud in etuds:
|
||||
G.inscrit_etudiant(sem, etud)
|
||||
G.set_etud_notes_sem(sem, eval_normales, etuds)
|
Loading…
Reference in New Issue
Block a user