2024-02-08 22:09:11 +01:00
|
|
|
##############################################################################
|
|
|
|
# Module "Avis de poursuite d'étude"
|
|
|
|
# conçu et développé par Cléo Baras (IUT de Grenoble)
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
"""Affichages, debug
|
|
|
|
"""
|
|
|
|
|
2024-02-11 22:06:37 +01:00
|
|
|
from flask import g
|
2024-01-27 08:22:36 +01:00
|
|
|
from app import log
|
|
|
|
|
2024-02-14 17:00:05 +01:00
|
|
|
PE_DEBUG = True
|
2024-01-27 08:22:36 +01:00
|
|
|
|
2024-02-02 11:49:24 +01:00
|
|
|
|
2024-02-11 22:06:37 +01:00
|
|
|
# On stocke les logs PE dans g.scodoc_pe_log
|
|
|
|
# pour ne pas modifier les nombreux appels à pe_print.
|
|
|
|
def pe_start_log() -> list[str]:
|
|
|
|
"Initialize log"
|
|
|
|
g.scodoc_pe_log = []
|
|
|
|
return g.scodoc_pe_log
|
|
|
|
|
|
|
|
|
|
|
|
def pe_print(*a):
|
|
|
|
"Log (or print in PE_DEBUG mode) and store in g"
|
|
|
|
if PE_DEBUG:
|
2024-02-14 17:00:05 +01:00
|
|
|
msg = " ".join(a)
|
2024-02-11 22:06:37 +01:00
|
|
|
print(msg)
|
|
|
|
else:
|
2024-02-14 17:00:05 +01:00
|
|
|
lines = getattr(g, "scodoc_pe_log")
|
|
|
|
if lines is None:
|
|
|
|
lines = pe_start_log()
|
|
|
|
msg = " ".join(a)
|
|
|
|
lines.append(msg)
|
2024-02-11 22:06:37 +01:00
|
|
|
log(msg)
|
|
|
|
|
|
|
|
|
|
|
|
def pe_get_log() -> str:
|
|
|
|
"Renvoie une chaîne avec tous les messages loggués"
|
|
|
|
return "\n".join(getattr(g, "scodoc_pe_log", []))
|
|
|
|
|
2024-01-25 17:17:01 +01:00
|
|
|
|
2024-02-02 06:11:21 +01:00
|
|
|
# Affichage dans le tableur pe en cas d'absence de notes
|
|
|
|
SANS_NOTE = "-"
|
2024-02-02 11:49:24 +01:00
|
|
|
NOM_STAT_GROUPE = "statistiques du groupe"
|
|
|
|
NOM_STAT_PROMO = "statistiques de la promo"
|