Bul. BUT: versions + nettoyage

This commit is contained in:
Emmanuel Viennet 2022-03-10 09:28:59 +01:00
parent 5efebb1336
commit 8be3ecfeaf
3 changed files with 13 additions and 99 deletions

View File

@ -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

View File

@ -35,6 +35,9 @@ class BulletinGeneratorStandardBUT(BulletinGeneratorStandard):
tables_infos = [
# ---- TABLE SYNTHESE UES
self.but_table_synthese_ues(),
]
if self.version != "short":
tables_infos += [
# ---- TABLE RESSOURCES
self.but_table_ressources(),
# ---- TABLE SAE

View File

@ -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"""<table class="bull_head"><tr><td>
<h2><a class="discretelink" href="{
url_for(
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etud.id
)}">{etud.nomprenom}</a></h2>
<form name="f" method="GET" action="{request.base_url}">
Bulletin <span class="bull_liensemestre"><a href="{
url_for("notes.formsemestre_status",
scodoc_dept=g.scodoc_dept,
formsemestre_id=formsemestre.id)}
">{formsemestre.titre_mois()}</a></span>
<br/>
<table><tr>
<td>établi le {time.strftime("%d/%m/%Y à %Hh%M")} (notes sur 20)</td>
<td><span class="rightjust">
<input type="hidden" name="formsemestre_id" value="{formsemestre.id}"></input>
<input type="hidden" name="etudid" value="{etud.id}"></input>
<input type="hidden" name="format" value="{format}"></input>
<select name="version" onchange="document.f.submit()" class="noprint">
""",
]
for (v, e) in (
("short", "Version courte"),
("selectedevals", "Version intermédiaire"),
("long", "Version complète"),
):
if v == version:
selected = " selected"
else:
selected = ""
H.append('<option value="%s"%s>%s</option>' % (v, selected, e))
H.append("""</select></td>""")
# Menu
endpoint = "notes.formsemestre_bulletinetud"
menu_autres_operations = make_menu_autres_operations(
formsemestre, etud, endpoint, version
)
H.append("""<td class="bulletin_menubar"><div class="bulletin_menubar">""")
H.append(menu_autres_operations)
H.append("""</div></td>""")
H.append(
'<td> <a href="%s">%s</a></td>'
% (
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("""</tr></table>""")
#
H.append(
"""</form></span></td><td class="bull_photo"><a href="%s">%s</a>
"""
% (
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(
"""</td></tr>
</table>
"""
)
return "".join(H)
def make_menu_autres_operations(
formsemestre: FormSemestre, etud: Identite, endpoint: str, version: str
) -> str: