From 62a813494cddc7e1e659a43b19a70564571a0c31 Mon Sep 17 00:00:00 2001 From: viennet Date: Mon, 28 Dec 2020 14:43:12 +0100 Subject: [PATCH] Fix: bulletins --- sco_bulletins_standard.py | 44 ++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/sco_bulletins_standard.py b/sco_bulletins_standard.py index 77b9b4ffb..fb439401a 100644 --- a/sco_bulletins_standard.py +++ b/sco_bulletins_standard.py @@ -48,10 +48,22 @@ Balises img: actuellement interdites. """ import traceback, re +import sco_utils as scu 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 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_pdf import sco_groups @@ -271,7 +283,6 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator): context = self.context P = [] # elems pour générer table avec gen_table (liste de dicts) formsemestre_id = I["formsemestre_id"] - sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) prefs = context.get_preferences(formsemestre_id) # Colonnes à afficher: @@ -328,8 +339,8 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator): linktmpl = ( '%s ' ) - minuslink = linktmpl % icontag("minus_img", border="0", alt="-") - pluslink = linktmpl % icontag("plus_img", border="0", alt="+") + minuslink = linktmpl % scu.icontag("minus_img", border="0", alt="-") + pluslink = linktmpl % scu.icontag("plus_img", border="0", alt="+") # 1er ligne titres t = { @@ -384,9 +395,7 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator): P.append(t) # Rangs dans les partitions: - partitions, partitions_etud_groups = sco_groups.get_formsemestre_groups( - context, formsemestre_id - ) + partitions, _ = sco_groups.get_formsemestre_groups(context, formsemestre_id) for partition in partitions: if partition["bul_show_rank"]: 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["_titre_help"] = "(en cours, non prise en compte)" if prefs["bul_show_minmax"]: - t["min"] = fmt_note(ue["min"]) - t["max"] = fmt_note(ue["max"]) + t["min"] = scu.fmt_note(ue["min"]) + t["max"] = scu.fmt_note(ue["max"]) 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) if ue["type"] == UE_SPORT and not ue_descr: del t["module"] @@ -595,10 +604,10 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator): "_pdf_style": pdf_style, } if prefs["bul_show_minmax_mod"]: - t["min"] = fmt_note(mod["stats"]["min"]) - t["max"] = fmt_note(mod["stats"]["max"]) + t["min"] = scu.fmt_note(mod["stats"]["min"]) + t["max"] = scu.fmt_note(mod["stats"]["max"]) 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) if self.version != "short": @@ -659,14 +668,15 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator): t["note"] = "" + e["note_txt"] + "" else: 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( self.context, e["evaluation_id"] ) - t["min"] = fmt_note(etat["mini"]) - t["max"] = fmt_note(etat["maxi"]) + if prefs["bul_show_minmax_eval"]: + t["min"] = scu.fmt_note(etat["mini"]) + t["max"] = scu.fmt_note(etat["maxi"]) if prefs["bul_show_moypromo"]: - t["moy"] = fmt_note(etat["moy"]) + t["moy"] = scu.fmt_note(etat["moy"]) P.append(t) nbeval += 1 return nbeval