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