2 small fixes
This commit is contained in:
parent
a8a711b30a
commit
81fab97018
@ -124,9 +124,9 @@ def table_billets(
|
||||
else:
|
||||
billet_dict["nomprenom"] = billet.etudiant.nomprenom
|
||||
billet_dict["_nomprenom_order"] = billet.etudiant.sort_key
|
||||
billet_dict[
|
||||
"_nomprenom_td_attrs"
|
||||
] = f'id="{billet.etudiant.id}" class="etudinfo"'
|
||||
billet_dict["_nomprenom_td_attrs"] = (
|
||||
f'id="{billet.etudiant.id}" class="etudinfo"'
|
||||
)
|
||||
if with_links:
|
||||
billet_dict["_nomprenom_target"] = url_for(
|
||||
"scolar.fiche_etud",
|
||||
|
@ -34,7 +34,7 @@ Il suffit d'appeler abs_notify() après chaque ajout d'absence.
|
||||
import datetime
|
||||
from typing import Optional
|
||||
|
||||
from flask import g, url_for
|
||||
from flask import flash, g, url_for
|
||||
from flask_mail import Message
|
||||
|
||||
from app import db
|
||||
@ -46,7 +46,6 @@ from app.models.etudiants import Identite
|
||||
from app.models.events import Scolog
|
||||
from app.models.formsemestre import FormSemestre
|
||||
import app.scodoc.notesdb as ndb
|
||||
from app.scodoc import sco_etud
|
||||
from app.scodoc import sco_preferences
|
||||
from app.scodoc import sco_utils as scu
|
||||
|
||||
@ -283,10 +282,17 @@ def abs_notification_message(
|
||||
)
|
||||
|
||||
template = prefs["abs_notification_mail_tmpl"]
|
||||
txt = ""
|
||||
if template:
|
||||
txt = prefs["abs_notification_mail_tmpl"] % values
|
||||
try:
|
||||
txt = prefs["abs_notification_mail_tmpl"] % values
|
||||
except KeyError:
|
||||
flash("Mail non envoyé: format invalide (voir paramétrage)")
|
||||
log("abs_notification_message: invalid key in abs_notification_mail_tmpl")
|
||||
txt = ""
|
||||
else:
|
||||
log("abs_notification_message: empty template, not sending message")
|
||||
if not txt:
|
||||
return None
|
||||
|
||||
subject = f"""[ScoDoc] Trop d'absences pour {etud.nomprenom}"""
|
||||
|
@ -65,7 +65,6 @@ from app.models import FormSemestre, Identite
|
||||
from app.scodoc import (
|
||||
codes_cursus,
|
||||
sco_cache,
|
||||
sco_groups_view,
|
||||
sco_pdf,
|
||||
sco_preferences,
|
||||
)
|
||||
@ -114,7 +113,8 @@ def assemble_bulletins_pdf(
|
||||
return data
|
||||
|
||||
|
||||
def replacement_function(match):
|
||||
def replacement_function(match) -> str:
|
||||
"remplace logo par balise html img"
|
||||
balise = match.group(1)
|
||||
name = match.group(3)
|
||||
logo = find_logo(logoname=name, dept_id=g.scodoc_dept_id)
|
||||
@ -235,12 +235,14 @@ def get_formsemestre_bulletins_pdf(
|
||||
)
|
||||
|
||||
etuds = formsemestre.get_inscrits(include_demdef=True, order=True)
|
||||
if groups_infos is not None:
|
||||
if groups_infos is None:
|
||||
gr_key = ""
|
||||
else:
|
||||
etudids = {m["etudid"] for m in groups_infos.members}
|
||||
etuds = [etud for etud in etuds if etud.id in etudids]
|
||||
cache_key = (
|
||||
str(formsemestre_id) + "_" + version + "_" + groups_infos.get_groups_key()
|
||||
)
|
||||
gr_key = groups_infos.get_groups_key()
|
||||
|
||||
cache_key = str(formsemestre_id) + "_" + version + "_" + gr_key
|
||||
cached = sco_cache.SemBulletinsPDFCache.get(cache_key)
|
||||
if cached:
|
||||
return cached[1], cached[0]
|
||||
@ -276,7 +278,7 @@ def get_formsemestre_bulletins_pdf(
|
||||
sco_pdf.PDFLOCK.release()
|
||||
#
|
||||
date_iso = time.strftime("%Y-%m-%d")
|
||||
filename = "bul-%s-%s.pdf" % (formsemestre.titre_num(), date_iso)
|
||||
filename = f"bul-{formsemestre.titre_num()}-{date_iso}.pdf"
|
||||
filename = scu.unescape_html(filename).replace(" ", "_").replace("&", "")
|
||||
# fill cache
|
||||
sco_cache.SemBulletinsPDFCache.set(
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
SCOVERSION = "9.6.943"
|
||||
SCOVERSION = "9.6.944"
|
||||
|
||||
SCONAME = "ScoDoc"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user