1
0
forked from ScoDoc/ScoDoc

Bul. BUT: SAE dans synthèse, pied de bul. sur meme page.

This commit is contained in:
Emmanuel Viennet 2022-03-10 09:18:19 +01:00
parent 9587159692
commit 5efebb1336
3 changed files with 27 additions and 25 deletions

View File

@ -6,7 +6,7 @@
"""Génération bulletin BUT au format PDF standard """Génération bulletin BUT au format PDF standard
""" """
import itertools
from reportlab.platypus import KeepInFrame, Paragraph, Spacer from reportlab.platypus import KeepInFrame, Paragraph, Spacer
from app.scodoc.sco_pdf import blue, cm, mm from app.scodoc.sco_pdf import blue, cm, mm
@ -141,26 +141,27 @@ class BulletinGeneratorStandardBUT(BulletinGeneratorStandard):
], ],
} }
rows.append(t) rows.append(t)
# Liste chaque ressource # Liste chaque ressource puis SAE
for mod_code, mod in ue["ressources"].items(): for mod_type in ("ressources", "saes"):
t = { for mod_code, mod in ue[mod_type].items():
"titre": f"{mod_code} {self.infos['ressources'][mod_code]['titre']}", t = {
"moyenne": mod["moyenne"], "titre": f"{mod_code} {self.infos[mod_type][mod_code]['titre']}",
"coef": mod["coef"], "moyenne": mod["moyenne"],
"_coef_pdf": Paragraph( "coef": mod["coef"],
f"<para align=right><i>{mod['coef']}</i></para>" "_coef_pdf": Paragraph(
), f"<para align=right><i>{mod['coef']}</i></para>"
"_pdf_style": [ ),
( "_pdf_style": [
"LINEBELOW", (
(0, 0), "LINEBELOW",
(-1, 0), (0, 0),
self.PDF_LINEWIDTH, (-1, 0),
(0.7, 0.7, 0.7), # gris clair self.PDF_LINEWIDTH,
) (0.7, 0.7, 0.7), # gris clair
], )
} ],
rows.append(t) }
rows.append(t)
# Global pdf style commands: # Global pdf style commands:
pdf_style = [ pdf_style = [
("VALIGN", (0, 0), (-1, -1), "TOP"), ("VALIGN", (0, 0), (-1, -1), "TOP"),

View File

@ -46,10 +46,11 @@ de la forme %(XXX)s sont remplacées par la valeur de XXX, pour XXX dans:
Balises img: actuellement interdites. Balises img: actuellement interdites.
""" """
from reportlab.platypus import KeepTogether, Paragraph, Spacer, Table
from reportlab.lib.units import cm, mm
from reportlab.lib.colors import Color, blue
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc.sco_pdf import Color, Paragraph, Spacer, Table
from app.scodoc.sco_pdf import blue, cm, mm
from app.scodoc.sco_pdf import SU from app.scodoc.sco_pdf import SU
from app.scodoc import sco_preferences from app.scodoc import sco_preferences
from app.scodoc.sco_permissions import Permission from app.scodoc.sco_permissions import Permission
@ -195,7 +196,7 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
# ----- # -----
if format == "pdf": if format == "pdf":
return Op return [KeepTogether(Op)]
elif format == "html": elif format == "html":
return "\n".join(H) return "\n".join(H)

View File

@ -124,7 +124,7 @@ def get_partition(partition_id):
{"partition_id": partition_id}, {"partition_id": partition_id},
) )
if not r: if not r:
raise ValueError("invalid partition_id (%s)" % partition_id) raise ScoValueError(f"Partition inconnue (déjà supprimée ?) ({partition_id})")
return r[0] return r[0]