Bul. BUT PDF: rang dans les UE, cache bonus/malus quand ils sont nuls

This commit is contained in:
Emmanuel Viennet 2022-09-18 21:58:38 +02:00
parent acd1b36d72
commit f183cc3c27
2 changed files with 15 additions and 17 deletions

View File

@ -80,8 +80,6 @@ class BulletinGeneratorStandardBUT(BulletinGeneratorStandard):
"coef": 2 * cm, "coef": 2 * cm,
} }
title_bg = tuple(x / 255.0 for x in title_bg) title_bg = tuple(x / 255.0 for x in title_bg)
nota_bene = """La moyenne des ressources et SAÉs dans une UE
dépend des poids donnés aux évaluations."""
# elems pour générer table avec gen_table (liste de dicts) # elems pour générer table avec gen_table (liste de dicts)
rows = [ rows = [
# Ligne de titres # Ligne de titres
@ -92,17 +90,6 @@ class BulletinGeneratorStandardBUT(BulletinGeneratorStandard):
"_coef_pdf": Paragraph("<para align=right><b><i>Coef.</i></b></para>"), "_coef_pdf": Paragraph("<para align=right><b><i>Coef.</i></b></para>"),
"_css_row_class": "note_bold", "_css_row_class": "note_bold",
"_pdf_row_markup": ["b"], "_pdf_row_markup": ["b"],
"_pdf_style": [
("BACKGROUND", (0, 0), (-1, 0), title_bg),
# ("BOTTOMPADDING", (0, 0), (-1, 0), 7),
],
},
{
"titre": nota_bene,
"_titre_pdf": Paragraph(
f"<para fontSize={self.small_fontsize}><i>{nota_bene}</i></para>"
),
"_titre_colspan": 3,
"_pdf_style": [ "_pdf_style": [
("BACKGROUND", (0, 0), (-1, 0), title_bg), ("BACKGROUND", (0, 0), (-1, 0), title_bg),
("BOTTOMPADDING", (0, 0), (-1, 0), 7), ("BOTTOMPADDING", (0, 0), (-1, 0), 7),
@ -167,17 +154,26 @@ class BulletinGeneratorStandardBUT(BulletinGeneratorStandard):
ects_txt = f'ECTS: {ue["ECTS"]["acquis"]:.3g} / {ue["ECTS"]["total"]:.3g}' ects_txt = f'ECTS: {ue["ECTS"]["acquis"]:.3g} / {ue["ECTS"]["total"]:.3g}'
else: else:
ects_txt = "" ects_txt = ""
# case Bonus/Malus/Rang "bmr"
fields_bmr = []
if float(ue["bonus"]) != 0:
fields_bmr.append(f"Bonus: {ue['bonus']}")
if float(ue["malus"]) != 0:
fields_bmr.append(f"Malus: {ue['malus']}")
if self.preferences["bul_show_ue_rangs"]:
fields_bmr.append(
f"Rang: {ue['moyenne']['rang']} / {ue['moyenne']['total']}"
)
t = { t = {
"titre": f"""Bonus: {ue['bonus']} - Malus: { "titre": " - ".join(fields_bmr),
ue["malus"]}""",
"coef": ects_txt, "coef": ects_txt,
"_coef_pdf": Paragraph(f"""<para align=left>{ects_txt}</para>"""), "_coef_pdf": Paragraph(f"""<para align=left>{ects_txt}</para>"""),
"_coef_colspan": 2, "_coef_colspan": 2,
"_pdf_style": [ "_pdf_style": [
("BACKGROUND", (0, 0), (-1, 0), title_bg), ("BACKGROUND", (0, 0), (-1, 0), title_bg),
("LINEBELOW", (0, 0), (-1, 0), self.PDF_LINEWIDTH, self.PDF_LINECOLOR), ("LINEBELOW", (0, 0), (-1, 0), self.PDF_LINEWIDTH, self.PDF_LINECOLOR),
# cadre autour du bonus/malus, gris clair # ligne au dessus du bonus/malus, gris clair
("BOX", (0, 0), (0, 0), self.PDF_LINEWIDTH, (0.7, 0.7, 0.7)), ("LINEABOVE", (0, 0), (-1, 0), self.PDF_LINEWIDTH, (0.7, 0.7, 0.7)),
], ],
} }
rows.append(t) rows.append(t)

View File

@ -1218,6 +1218,7 @@ class BasePreferences(object):
{ {
"initvalue": 0, "initvalue": 0,
"title": "Afficher les matières sur les bulletins", "title": "Afficher les matières sur les bulletins",
"explanation": "(sans effet en BUT)",
"input_type": "boolcheckbox", "input_type": "boolcheckbox",
"category": "bul", "category": "bul",
"labels": ["non", "oui"], "labels": ["non", "oui"],
@ -1259,6 +1260,7 @@ class BasePreferences(object):
{ {
"initvalue": 1, "initvalue": 1,
"title": "Afficher le classement dans chaque module sur les bulletins", "title": "Afficher le classement dans chaque module sur les bulletins",
"explanation": "(sans effet en BUT)",
"input_type": "boolcheckbox", "input_type": "boolcheckbox",
"category": "bul", "category": "bul",
"labels": ["non", "oui"], "labels": ["non", "oui"],