From 8be3ecfeafbcdeb8261364ec0fe17dfc459689cf Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 10 Mar 2022 09:28:59 +0100 Subject: [PATCH] Bul. BUT: versions + nettoyage --- app/but/bulletin_but.py | 6 ++- app/but/bulletin_but_pdf.py | 11 +++-- app/scodoc/sco_bulletins.py | 95 +------------------------------------ 3 files changed, 13 insertions(+), 99 deletions(-) diff --git a/app/but/bulletin_but.py b/app/but/bulletin_but.py index a533fb80..13af9dea 100644 --- a/app/but/bulletin_but.py +++ b/app/but/bulletin_but.py @@ -330,11 +330,13 @@ class BulletinBUT: return d - def bulletin_etud_complet(self, etud: Identite) -> dict: + def bulletin_etud_complet(self, etud: Identite, version="long") -> dict: """Bulletin dict complet avec toutes les infos pour les bulletins BUT pdf Résultat compatible avec celui de sco_bulletins.formsemestre_bulletinetud_dict """ - d = self.bulletin_etud(etud, self.res.formsemestre, force_publishing=True) + d = self.bulletin_etud( + etud, self.res.formsemestre, version=version, force_publishing=True + ) d["etudid"] = etud.id d["etud"] = d["etudiant"] d["etud"]["nomprenom"] = etud.nomprenom diff --git a/app/but/bulletin_but_pdf.py b/app/but/bulletin_but_pdf.py index 6a317684..5263091a 100644 --- a/app/but/bulletin_but_pdf.py +++ b/app/but/bulletin_but_pdf.py @@ -35,11 +35,14 @@ class BulletinGeneratorStandardBUT(BulletinGeneratorStandard): tables_infos = [ # ---- TABLE SYNTHESE UES self.but_table_synthese_ues(), - # ---- TABLE RESSOURCES - self.but_table_ressources(), - # ---- TABLE SAE - self.but_table_saes(), ] + if self.version != "short": + tables_infos += [ + # ---- TABLE RESSOURCES + self.but_table_ressources(), + # ---- TABLE SAE + self.but_table_saes(), + ] objects = [] for i, (col_keys, rows, pdf_style, col_widths) in enumerate(tables_infos): table = gen_tables.GenTable( diff --git a/app/scodoc/sco_bulletins.py b/app/scodoc/sco_bulletins.py index 65dcb3a9..b9ebdfcc 100644 --- a/app/scodoc/sco_bulletins.py +++ b/app/scodoc/sco_bulletins.py @@ -885,7 +885,7 @@ def do_formsemestre_bulletinetud( if formsemestre.formation.is_apc(): etud = Identite.query.get(etudid) r = bulletin_but.BulletinBUT(formsemestre) - I = r.bulletin_etud_complet(etud) + I = r.bulletin_etud_complet(etud, version=version) else: I = formsemestre_bulletinetud_dict(formsemestre.id, etudid) etud = I["etud"] @@ -980,7 +980,7 @@ def mail_bulletin(formsemestre_id, I, pdfdata, filename, recipient_addr): except KeyError as e: raise ScoValueError( "format 'Message d'accompagnement' (bul_intro_mail) invalide, revoir les réglages dans les préférences" - ) + ) from e else: hea = "" @@ -1011,97 +1011,6 @@ def mail_bulletin(formsemestre_id, I, pdfdata, filename, recipient_addr): ) -def _formsemestre_bulletinetud_header_html_old_XXX( - etud: Identite, - formsemestre: FormSemestre, - format=None, - version=None, -): - H = [ - html_sco_header.sco_header( - page_title=f"Bulletin de {etud.nomprenom}", - javascripts=[ - "js/bulletin.js", - "libjs/d3.v3.min.js", - "js/radar_bulletin.js", - ], - cssstyles=["css/radar_bulletin.css"], - ), - f""" -
-

{etud.nomprenom}

- -
- Bulletin {formsemestre.titre_mois()} -
- - - """) - # Menu - endpoint = "notes.formsemestre_bulletinetud" - menu_autres_operations = make_menu_autres_operations( - formsemestre, etud, endpoint, version - ) - - H.append("""""") - H.append( - '' - % ( - url_for( - "notes.formsemestre_bulletinetud", - scodoc_dept=g.scodoc_dept, - formsemestre_id=formsemestre.id, - etudid=etud.id, - format="pdf", - version=version, - ), - scu.ICON_PDF, - ) - ) - H.append("""
établi le {time.strftime("%d/%m/%Y à %Hh%M")} (notes sur 20) - - - -
""") - H.append(menu_autres_operations) - H.append("""
%s
""") - # - H.append( - """
%s - """ - % ( - url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etud.id), - sco_photos.etud_photo_html(etud, title="fiche de " + etud.nomprenom), - ) - ) - H.append( - """
- """ - ) - - return "".join(H) - - def make_menu_autres_operations( formsemestre: FormSemestre, etud: Identite, endpoint: str, version: str ) -> str: