1
0
forked from ScoDoc/ScoDoc

Bul. BUT PDF: affichage (optionel) des min/max/moy promo sur les moyennes d'UE

This commit is contained in:
Emmanuel Viennet 2022-09-18 22:29:17 +02:00
parent f183cc3c27
commit 22f906e726
2 changed files with 53 additions and 11 deletions

View File

@ -76,15 +76,34 @@ class BulletinGeneratorStandardBUT(BulletinGeneratorStandard):
""" """
col_widths = { col_widths = {
"titre": None, "titre": None,
"min": 1.5 * cm,
"moy": 1.5 * cm,
"max": 1.5 * cm,
"moyenne": 2 * cm, "moyenne": 2 * cm,
"coef": 2 * cm, "coef": 2 * cm,
} }
with_col_minmax = self.preferences["bul_show_minmax"]
with_col_moypromo = self.preferences["bul_show_moypromo"]
# Noms des colonnes à afficher:
col_keys = ["titre"]
if with_col_minmax:
col_keys += ["min"]
if with_col_moypromo:
col_keys += ["moy"]
if with_col_minmax:
col_keys += ["max"]
col_keys += ["coef", "moyenne"]
# Couleur fond:
title_bg = tuple(x / 255.0 for x in title_bg) title_bg = tuple(x / 255.0 for x in title_bg)
# 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
{ {
"titre": "Unités d'enseignement", "titre": "Unités d'enseignement",
"min": "Promotion",
"moy": "",
"max": "",
"_min_colspan": 2,
"moyenne": Paragraph("<para align=right><b>Note/20</b></para>"), "moyenne": Paragraph("<para align=right><b>Note/20</b></para>"),
"coef": "Coef.", "coef": "Coef.",
"_coef_pdf": Paragraph("<para align=right><b><i>Coef.</i></b></para>"), "_coef_pdf": Paragraph("<para align=right><b><i>Coef.</i></b></para>"),
@ -92,20 +111,40 @@ class BulletinGeneratorStandardBUT(BulletinGeneratorStandard):
"_pdf_row_markup": ["b"], "_pdf_row_markup": ["b"],
"_pdf_style": [ "_pdf_style": [
("BACKGROUND", (0, 0), (-1, 0), title_bg), ("BACKGROUND", (0, 0), (-1, 0), title_bg),
("BOTTOMPADDING", (0, 0), (-1, 0), 7),
(
"LINEBELOW",
(0, 0),
(-1, 0),
self.PDF_LINEWIDTH,
blue,
),
], ],
}, },
] ]
col_keys = ["titre", "coef", "moyenne"] # noms des colonnes à afficher if with_col_moypromo and not with_col_minmax:
rows[-1]["moy"] = "Promotion"
# 2eme ligne titres si nécessaire
if with_col_minmax: # TODO or with_col_abs:
rows.append(
{
"min": "min.",
"moy": "moy.",
"max": "max.",
# "abs": "(Tot. / J.)",
"_css_row_class": "note_bold",
"_pdf_row_markup": ["b"],
"_pdf_style": [
("BACKGROUND", (0, 0), (-1, 0), title_bg),
],
}
)
rows[-1]["_pdf_style"] += [
("BOTTOMPADDING", (0, 0), (-1, 0), 7),
(
"LINEBELOW",
(0, 0),
(-1, 0),
self.PDF_LINEWIDTH,
blue,
),
]
for ue_acronym, ue in self.infos["ues"].items(): for ue_acronym, ue in self.infos["ues"].items():
self.ue_rows(rows, ue_acronym, ue, title_bg) self.ue_rows(rows, ue_acronym, ue, title_bg)
# Global pdf style commands: # Global pdf style commands:
pdf_style = [ pdf_style = [
("VALIGN", (0, 0), (-1, -1), "TOP"), ("VALIGN", (0, 0), (-1, -1), "TOP"),
@ -175,6 +214,9 @@ class BulletinGeneratorStandardBUT(BulletinGeneratorStandard):
# ligne au dessus du bonus/malus, gris clair # ligne au dessus du bonus/malus, gris clair
("LINEABOVE", (0, 0), (-1, 0), self.PDF_LINEWIDTH, (0.7, 0.7, 0.7)), ("LINEABOVE", (0, 0), (-1, 0), self.PDF_LINEWIDTH, (0.7, 0.7, 0.7)),
], ],
"min": ue["moyenne"]["min"],
"max": ue["moyenne"]["max"],
"moy": ue["moyenne"]["moy"],
} }
rows.append(t) rows.append(t)

View File

@ -362,9 +362,9 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
# 2eme ligne titres si nécessaire # 2eme ligne titres si nécessaire
if with_col_minmax or with_col_abs: if with_col_minmax or with_col_abs:
t = { t = {
"min": "mini", "min": "min.",
"moy": "moy.", "moy": "moy.",
"max": "maxi", "max": "max.",
"abs": "(Tot. / J.)", "abs": "(Tot. / J.)",
"_css_row_class": "note_bold", "_css_row_class": "note_bold",
"_pdf_row_markup": ["b"], "_pdf_row_markup": ["b"],