Fix: bulletins

This commit is contained in:
viennet 2020-12-28 14:43:12 +01:00
parent 274d39a3ec
commit 62a813494c

View File

@ -48,10 +48,22 @@ Balises img: actuellement interdites.
""" """
import traceback, re import traceback, re
import sco_utils as scu
import sco_formsemestre import sco_formsemestre
from sco_pdf import * import sco_pdf
from sco_pdf import Color, Paragraph, Spacer, Table
from sco_pdf import blue, cm, mm
from sco_pdf import SU
import sco_preferences import sco_preferences
from notes_log import log from notes_log import log
from sco_permissions import ScoEtudInscrit
from sco_codes_parcours import (
UE_COLORS,
UE_DEFAULT_COLOR,
UE_ELECTIVE,
UE_SPORT,
UE_STANDARD,
)
import sco_bulletins_generator import sco_bulletins_generator
import sco_bulletins_pdf import sco_bulletins_pdf
import sco_groups import sco_groups
@ -271,7 +283,6 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
context = self.context context = self.context
P = [] # elems pour générer table avec gen_table (liste de dicts) P = [] # elems pour générer table avec gen_table (liste de dicts)
formsemestre_id = I["formsemestre_id"] formsemestre_id = I["formsemestre_id"]
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
prefs = context.get_preferences(formsemestre_id) prefs = context.get_preferences(formsemestre_id)
# Colonnes à afficher: # Colonnes à afficher:
@ -328,8 +339,8 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
linktmpl = ( linktmpl = (
'<span onclick="toggle_vis_ue(this);" class="toggle_ue">%s</span>&nbsp;' '<span onclick="toggle_vis_ue(this);" class="toggle_ue">%s</span>&nbsp;'
) )
minuslink = linktmpl % icontag("minus_img", border="0", alt="-") minuslink = linktmpl % scu.icontag("minus_img", border="0", alt="-")
pluslink = linktmpl % icontag("plus_img", border="0", alt="+") pluslink = linktmpl % scu.icontag("plus_img", border="0", alt="+")
# 1er ligne titres # 1er ligne titres
t = { t = {
@ -384,9 +395,7 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
P.append(t) P.append(t)
# Rangs dans les partitions: # Rangs dans les partitions:
partitions, partitions_etud_groups = sco_groups.get_formsemestre_groups( partitions, _ = sco_groups.get_formsemestre_groups(context, formsemestre_id)
context, formsemestre_id
)
for partition in partitions: for partition in partitions:
if partition["bul_show_rank"]: if partition["bul_show_rank"]:
partition_id = partition["partition_id"] partition_id = partition["partition_id"]
@ -486,10 +495,10 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
t["_css_row_class"] += " notes_bulletin_row_ue_cur" t["_css_row_class"] += " notes_bulletin_row_ue_cur"
t["_titre_help"] = "(en cours, non prise en compte)" t["_titre_help"] = "(en cours, non prise en compte)"
if prefs["bul_show_minmax"]: if prefs["bul_show_minmax"]:
t["min"] = fmt_note(ue["min"]) t["min"] = scu.fmt_note(ue["min"])
t["max"] = fmt_note(ue["max"]) t["max"] = scu.fmt_note(ue["max"])
if prefs["bul_show_moypromo"]: if prefs["bul_show_moypromo"]:
t["moy"] = fmt_note(ue["moy"]).replace("NA", "-") t["moy"] = scu.fmt_note(ue["moy"]).replace("NA", "-")
# Cas particulier des UE sport (bonus) # Cas particulier des UE sport (bonus)
if ue["type"] == UE_SPORT and not ue_descr: if ue["type"] == UE_SPORT and not ue_descr:
del t["module"] del t["module"]
@ -595,10 +604,10 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
"_pdf_style": pdf_style, "_pdf_style": pdf_style,
} }
if prefs["bul_show_minmax_mod"]: if prefs["bul_show_minmax_mod"]:
t["min"] = fmt_note(mod["stats"]["min"]) t["min"] = scu.fmt_note(mod["stats"]["min"])
t["max"] = fmt_note(mod["stats"]["max"]) t["max"] = scu.fmt_note(mod["stats"]["max"])
if prefs["bul_show_moypromo"]: if prefs["bul_show_moypromo"]:
t["moy"] = fmt_note(mod["stats"]["moy"]).replace("NA", "-") t["moy"] = scu.fmt_note(mod["stats"]["moy"]).replace("NA", "-")
P.append(t) P.append(t)
if self.version != "short": if self.version != "short":
@ -659,14 +668,15 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
t["note"] = "<i>" + e["note_txt"] + "</i>" t["note"] = "<i>" + e["note_txt"] + "</i>"
else: else:
t["_module_colspan"] = 2 t["_module_colspan"] = 2
if prefs["bul_show_minmax_eval"]: if prefs["bul_show_minmax_eval"] or prefs["bul_show_moypromo"]:
etat = sco_evaluations.do_evaluation_etat( etat = sco_evaluations.do_evaluation_etat(
self.context, e["evaluation_id"] self.context, e["evaluation_id"]
) )
t["min"] = fmt_note(etat["mini"]) if prefs["bul_show_minmax_eval"]:
t["max"] = fmt_note(etat["maxi"]) t["min"] = scu.fmt_note(etat["mini"])
t["max"] = scu.fmt_note(etat["maxi"])
if prefs["bul_show_moypromo"]: if prefs["bul_show_moypromo"]:
t["moy"] = fmt_note(etat["moy"]) t["moy"] = scu.fmt_note(etat["moy"])
P.append(t) P.append(t)
nbeval += 1 nbeval += 1
return nbeval return nbeval