forked from ScoDoc/ScoDoc
Update opolka/ScoDoc from ScoDoc/ScoDoc #2
@ -31,6 +31,7 @@ from app.scodoc.sco_bulletins_standard import BulletinGeneratorStandard
|
||||
from app.scodoc.sco_logos import Logo
|
||||
from app.scodoc.sco_pdf import PDFLOCK, SU
|
||||
from app.scodoc.sco_preferences import SemPreferences
|
||||
from app.scodoc import sco_utils as scu
|
||||
|
||||
|
||||
def make_bulletin_but_court_pdf(
|
||||
@ -343,9 +344,11 @@ class BulletinGeneratorBUTCourt(BulletinGeneratorStandard):
|
||||
for mod in self.bul[mod_type]:
|
||||
row = [mod, bul[mod_type][mod]["titre"]]
|
||||
row += [
|
||||
(
|
||||
bul["ues"][ue][mod_type][mod]["moyenne"]
|
||||
if mod in bul["ues"][ue][mod_type]
|
||||
else ""
|
||||
)
|
||||
for ue in self.ues_acronyms
|
||||
]
|
||||
rows.append(row)
|
||||
@ -523,7 +526,7 @@ class BulletinGeneratorBUTCourt(BulletinGeneratorStandard):
|
||||
if self.bul["semestre"].get("decision_annee", None):
|
||||
txt += f"""
|
||||
Décision saisie le {
|
||||
datetime.datetime.fromisoformat(self.bul["semestre"]["decision_annee"]["date"]).strftime("%d/%m/%Y")
|
||||
datetime.datetime.fromisoformat(self.bul["semestre"]["decision_annee"]["date"]).strftime(scu.DATE_FMT)
|
||||
}, année BUT{self.bul["semestre"]["decision_annee"]["ordre"]}
|
||||
<b>{self.bul["semestre"]["decision_annee"]["code"]}</b>.
|
||||
<br/>
|
||||
|
@ -269,7 +269,7 @@ class BulletinGeneratorStandardBUT(BulletinGeneratorStandard):
|
||||
date_capitalisation = ue.get("date_capitalisation")
|
||||
if date_capitalisation:
|
||||
fields_bmr.append(
|
||||
f"""Capitalisée le {date_capitalisation.strftime("%d/%m/%Y")}"""
|
||||
f"""Capitalisée le {date_capitalisation.strftime(scu.DATE_FMT)}"""
|
||||
)
|
||||
t = {
|
||||
"titre": " - ".join(fields_bmr),
|
||||
|
@ -21,8 +21,6 @@ from app.but.jury_but import (
|
||||
DecisionsProposeesRCUE,
|
||||
DecisionsProposeesUE,
|
||||
)
|
||||
from app.comp import res_sem
|
||||
from app.comp.res_but import ResultatsSemestreBUT
|
||||
from app.models import (
|
||||
ApcNiveau,
|
||||
FormSemestre,
|
||||
@ -33,11 +31,8 @@ from app.models import (
|
||||
ScolarFormSemestreValidation,
|
||||
ScolarNews,
|
||||
)
|
||||
from app.models.config import ScoDocSiteConfig
|
||||
from app.scodoc import html_sco_header
|
||||
from app.scodoc import codes_cursus as sco_codes
|
||||
from app.scodoc.sco_exceptions import ScoValueError
|
||||
from app.scodoc import sco_preferences
|
||||
from app.scodoc import sco_utils as scu
|
||||
|
||||
|
||||
@ -217,7 +212,7 @@ def _gen_but_niveau_ue(
|
||||
scoplement = f"""<div class="scoplement">
|
||||
<div>
|
||||
<b>UE {ue.acronyme} capitalisée </b>
|
||||
<span>le {dec_ue.ue_status["event_date"].strftime("%d/%m/%Y")}
|
||||
<span>le {dec_ue.ue_status["event_date"].strftime(scu.DATE_FMT)}
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
@ -233,7 +228,7 @@ def _gen_but_niveau_ue(
|
||||
<div>
|
||||
<b>UE {ue.acronyme} antérieure </b>
|
||||
<span>validée {dec_ue.validation.code}
|
||||
le {dec_ue.validation.event_date.strftime("%d/%m/%Y")}
|
||||
le {dec_ue.validation.event_date.strftime(scu.DATE_FMT)}
|
||||
</span>
|
||||
</div>
|
||||
<div>Non reprise dans l'année en cours</div>
|
||||
@ -251,9 +246,7 @@ def _gen_but_niveau_ue(
|
||||
moy_ue_str = f"""<span>{scu.fmt_note(dec_ue.moy_ue)}</span>"""
|
||||
if dec_ue.code_valide:
|
||||
date_str = (
|
||||
f"""enregistré le {dec_ue.validation.event_date.strftime("%d/%m/%Y")}
|
||||
à {dec_ue.validation.event_date.strftime("%Hh%M")}
|
||||
"""
|
||||
f"""enregistré le {dec_ue.validation.event_date.strftime(scu.DATEATIME_FMT)}"""
|
||||
if dec_ue.validation and dec_ue.validation.event_date
|
||||
else ""
|
||||
)
|
||||
|
@ -23,6 +23,7 @@ from app.models import (
|
||||
)
|
||||
from app.scodoc import sco_cache
|
||||
from app.scodoc import codes_cursus
|
||||
from app.scodoc import sco_utils as scu
|
||||
|
||||
|
||||
class ValidationsSemestre(ResultatsCache):
|
||||
@ -84,7 +85,7 @@ class ValidationsSemestre(ResultatsCache):
|
||||
"code": decision.code,
|
||||
"assidu": decision.assidu,
|
||||
"compense_formsemestre_id": decision.compense_formsemestre_id,
|
||||
"event_date": decision.event_date.strftime("%d/%m/%Y"),
|
||||
"event_date": decision.event_date.strftime(scu.DATE_FMT),
|
||||
}
|
||||
self.decisions_jury = decisions_jury
|
||||
|
||||
@ -107,7 +108,7 @@ class ValidationsSemestre(ResultatsCache):
|
||||
decisions_jury_ues[decision.etudid][decision.ue.id] = {
|
||||
"code": decision.code,
|
||||
"ects": ects, # 0. si UE non validée
|
||||
"event_date": decision.event_date.strftime("%d/%m/%Y"),
|
||||
"event_date": decision.event_date.strftime(scu.DATE_FMT),
|
||||
}
|
||||
|
||||
self.decisions_jury_ues = decisions_jury_ues
|
||||
|
@ -21,6 +21,7 @@ from app.scodoc import sco_abs_notification
|
||||
from app.scodoc.sco_archives_justificatifs import JustificatifArchiver
|
||||
from app.scodoc.sco_exceptions import ScoValueError
|
||||
from app.scodoc.sco_permissions import Permission
|
||||
from app.scodoc import sco_utils as scu
|
||||
from app.scodoc.sco_utils import (
|
||||
EtatAssiduite,
|
||||
EtatJustificatif,
|
||||
@ -113,9 +114,9 @@ class Assiduite(ScoDocModel):
|
||||
"entry_date": self.entry_date,
|
||||
"user_id": None if user is None else user.id, # l'uid
|
||||
"user_name": None if user is None else user.user_name, # le login
|
||||
"user_nom_complet": None
|
||||
if user is None
|
||||
else user.get_nomcomplet(), # "Marie Dupont"
|
||||
"user_nom_complet": (
|
||||
None if user is None else user.get_nomcomplet()
|
||||
), # "Marie Dupont"
|
||||
"est_just": self.est_just,
|
||||
"external_data": self.external_data,
|
||||
}
|
||||
@ -364,7 +365,7 @@ class Assiduite(ScoDocModel):
|
||||
retourne le texte "saisie le <date> par <User>"
|
||||
"""
|
||||
|
||||
date: str = self.entry_date.strftime("%d/%m/%Y à %H:%M")
|
||||
date: str = self.entry_date.strftime(scu.DATEATIME_FMT)
|
||||
utilisateur: str = ""
|
||||
if self.user is not None:
|
||||
self.user: User
|
||||
|
@ -10,6 +10,7 @@ from app.models.etudiants import Identite
|
||||
from app.models.formsemestre import FormSemestre
|
||||
from app.models.ues import UniteEns
|
||||
from app.scodoc import sco_preferences
|
||||
from app.scodoc import sco_utils as scu
|
||||
|
||||
|
||||
class ApcValidationRCUE(db.Model):
|
||||
@ -63,14 +64,13 @@ class ApcValidationRCUE(db.Model):
|
||||
|
||||
def __str__(self):
|
||||
return f"""Décision sur RCUE {self.ue1.acronyme}/{self.ue2.acronyme}: {
|
||||
self.code} enregistrée le {self.date.strftime("%d/%m/%Y")}"""
|
||||
self.code} enregistrée le {self.date.strftime(scu.DATE_FMT)}"""
|
||||
|
||||
def html(self) -> str:
|
||||
"description en HTML"
|
||||
return f"""Décision sur RCUE {self.ue1.acronyme}/{self.ue2.acronyme}:
|
||||
<b>{self.code}</b>
|
||||
<em>enregistrée le {self.date.strftime("%d/%m/%Y")}
|
||||
à {self.date.strftime("%Hh%M")}</em>"""
|
||||
<em>enregistrée le {self.date.strftime(scu.DATEATIME_FMT)}</em>"""
|
||||
|
||||
def annee(self) -> str:
|
||||
"""l'année BUT concernée: "BUT1", "BUT2" ou "BUT3" """
|
||||
@ -164,7 +164,7 @@ class ApcValidationAnnee(db.Model):
|
||||
def html(self) -> str:
|
||||
"Affichage html"
|
||||
date_str = (
|
||||
f"""le {self.date.strftime("%d/%m/%Y")} à {self.date.strftime("%Hh%M")}"""
|
||||
f"""le {self.date.strftime(scu.DATEATIME_FMT)}"""
|
||||
if self.date
|
||||
else "(sans date)"
|
||||
)
|
||||
|
@ -481,7 +481,9 @@ class Identite(models.ScoDocModel):
|
||||
"code_ine": self.code_ine or "",
|
||||
"code_nip": self.code_nip or "",
|
||||
"date_naissance": (
|
||||
self.date_naissance.strftime("%d/%m/%Y") if self.date_naissance else ""
|
||||
self.date_naissance.strftime(scu.DATE_FMT)
|
||||
if self.date_naissance
|
||||
else ""
|
||||
),
|
||||
"dept_acronym": self.departement.acronym,
|
||||
"dept_id": self.dept_id,
|
||||
@ -733,7 +735,7 @@ class Identite(models.ScoDocModel):
|
||||
"""
|
||||
if with_paragraph:
|
||||
return f"""{self.etat_civil}{line_sep}n°{self.code_nip or ""}{line_sep}né{self.e} le {
|
||||
self.date_naissance.strftime("%d/%m/%Y") if self.date_naissance else ""}{
|
||||
self.date_naissance.strftime(scu.DATE_FMT) if self.date_naissance else ""}{
|
||||
line_sep}à {self.lieu_naissance or ""}"""
|
||||
return self.etat_civil
|
||||
|
||||
|
@ -207,7 +207,9 @@ class Evaluation(models.ScoDocModel):
|
||||
e_dict["poids"] = self.get_ue_poids_dict() # { ue_id : poids }
|
||||
|
||||
# Deprecated
|
||||
e_dict["jour"] = self.date_debut.strftime("%d/%m/%Y") if self.date_debut else ""
|
||||
e_dict["jour"] = (
|
||||
self.date_debut.strftime(scu.DATE_FMT) if self.date_debut else ""
|
||||
)
|
||||
|
||||
return evaluation_enrich_dict(self, e_dict)
|
||||
|
||||
@ -315,10 +317,10 @@ class Evaluation(models.ScoDocModel):
|
||||
def descr_heure(self) -> str:
|
||||
"Description de la plage horaire pour affichages ('de 13h00 à 14h00')"
|
||||
if self.date_debut and (not self.date_fin or self.date_fin == self.date_debut):
|
||||
return f"""à {self.date_debut.strftime("%Hh%M")}"""
|
||||
return f"""à {self.date_debut.strftime(scu.TIME_FMT)}"""
|
||||
elif self.date_debut and self.date_fin:
|
||||
return f"""de {self.date_debut.strftime("%Hh%M")
|
||||
} à {self.date_fin.strftime("%Hh%M")}"""
|
||||
return f"""de {self.date_debut.strftime(scu.TIME_FMT)
|
||||
} à {self.date_fin.strftime(scu.TIME_FMT)}"""
|
||||
else:
|
||||
return ""
|
||||
|
||||
@ -345,7 +347,7 @@ class Evaluation(models.ScoDocModel):
|
||||
|
||||
def _h(dt: datetime.datetime) -> str:
|
||||
if dt.minute:
|
||||
return dt.strftime("%Hh%M")
|
||||
return dt.strftime(scu.TIME_FMT)
|
||||
return f"{dt.hour}h"
|
||||
|
||||
if self.date_fin is None:
|
||||
@ -539,8 +541,8 @@ class EvaluationUEPoids(db.Model):
|
||||
def evaluation_enrich_dict(e: Evaluation, e_dict: dict):
|
||||
"""add or convert some fields in an evaluation dict"""
|
||||
# For ScoDoc7 compat
|
||||
e_dict["heure_debut"] = e.date_debut.strftime("%Hh%M") if e.date_debut else ""
|
||||
e_dict["heure_fin"] = e.date_fin.strftime("%Hh%M") if e.date_fin else ""
|
||||
e_dict["heure_debut"] = e.date_debut.strftime(scu.TIME_FMT) if e.date_debut else ""
|
||||
e_dict["heure_fin"] = e.date_fin.strftime(scu.TIME_FMT) if e.date_fin else ""
|
||||
e_dict["jour_iso"] = e.date_debut.isoformat() if e.date_debut else ""
|
||||
# Calcule durée en minutes
|
||||
e_dict["descrheure"] = e.descr_heure()
|
||||
@ -614,7 +616,7 @@ def check_and_convert_evaluation_args(data: dict, moduleimpl: "ModuleImpl"):
|
||||
):
|
||||
raise ScoValueError(
|
||||
f"""La date de début de l'évaluation ({
|
||||
data["date_debut"].strftime("%d/%m/%Y")
|
||||
data["date_debut"].strftime(scu.DATE_FMT)
|
||||
}) n'est pas dans le semestre !""",
|
||||
dest_url="javascript:history.back();",
|
||||
)
|
||||
@ -629,7 +631,7 @@ def check_and_convert_evaluation_args(data: dict, moduleimpl: "ModuleImpl"):
|
||||
):
|
||||
raise ScoValueError(
|
||||
f"""La date de fin de l'évaluation ({
|
||||
data["date_fin"].strftime("%d/%m/%Y")
|
||||
data["date_fin"].strftime(scu.DATE_FMT)
|
||||
}) n'est pas dans le semestre !""",
|
||||
dest_url="javascript:history.back();",
|
||||
)
|
||||
|
@ -224,12 +224,12 @@ class FormSemestre(models.ScoDocModel):
|
||||
d["formsemestre_id"] = self.id
|
||||
d["titre_num"] = self.titre_num()
|
||||
if self.date_debut:
|
||||
d["date_debut"] = self.date_debut.strftime("%d/%m/%Y")
|
||||
d["date_debut"] = self.date_debut.strftime(scu.DATE_FMT)
|
||||
d["date_debut_iso"] = self.date_debut.isoformat()
|
||||
else:
|
||||
d["date_debut"] = d["date_debut_iso"] = ""
|
||||
if self.date_fin:
|
||||
d["date_fin"] = self.date_fin.strftime("%d/%m/%Y")
|
||||
d["date_fin"] = self.date_fin.strftime(scu.DATE_FMT)
|
||||
d["date_fin_iso"] = self.date_fin.isoformat()
|
||||
else:
|
||||
d["date_fin"] = d["date_fin_iso"] = ""
|
||||
@ -255,12 +255,12 @@ class FormSemestre(models.ScoDocModel):
|
||||
d["annee_scolaire"] = self.annee_scolaire()
|
||||
d["bul_hide_xml"] = self.bul_hide_xml
|
||||
if self.date_debut:
|
||||
d["date_debut"] = self.date_debut.strftime("%d/%m/%Y")
|
||||
d["date_debut"] = self.date_debut.strftime(scu.DATE_FMT)
|
||||
d["date_debut_iso"] = self.date_debut.isoformat()
|
||||
else:
|
||||
d["date_debut"] = d["date_debut_iso"] = ""
|
||||
if self.date_fin:
|
||||
d["date_fin"] = self.date_fin.strftime("%d/%m/%Y")
|
||||
d["date_fin"] = self.date_fin.strftime(scu.DATE_FMT)
|
||||
d["date_fin_iso"] = self.date_fin.isoformat()
|
||||
else:
|
||||
d["date_fin"] = d["date_fin_iso"] = ""
|
||||
|
@ -72,7 +72,7 @@ class ScolarFormSemestreValidation(db.Model):
|
||||
return f"""décision sur UE {self.ue.acronyme if self.ue else self.ue_id
|
||||
} ({self.ue_id}): {self.code}"""
|
||||
return f"""décision sur semestre {self.formsemestre.titre_mois()} du {
|
||||
self.event_date.strftime("%d/%m/%Y")}"""
|
||||
self.event_date.strftime(scu.DATE_FMT)}"""
|
||||
|
||||
def delete(self):
|
||||
"Efface cette validation"
|
||||
@ -113,14 +113,14 @@ class ScolarFormSemestreValidation(db.Model):
|
||||
if self.ue.parcours else ""}
|
||||
{("émise par " + link)}
|
||||
: <b>{self.code}</b>{moyenne}
|
||||
le {self.event_date.strftime("%d/%m/%Y")} à {self.event_date.strftime("%Hh%M")}
|
||||
le {self.event_date.strftime(scu.DATEATIME_FMT)}
|
||||
"""
|
||||
else:
|
||||
return f"""Validation du semestre S{
|
||||
self.formsemestre.semestre_id if self.formsemestre else "?"}
|
||||
{self.formsemestre.html_link_status() if self.formsemestre else ""}
|
||||
: <b>{self.code}</b>
|
||||
le {self.event_date.strftime("%d/%m/%Y")} à {self.event_date.strftime("%Hh%M")}
|
||||
le {self.event_date.strftime(scu.DATEATIME_FMT)}
|
||||
"""
|
||||
|
||||
def ects(self) -> float:
|
||||
@ -175,7 +175,7 @@ class ScolarAutorisationInscription(db.Model):
|
||||
)
|
||||
return f"""Autorisation de passage vers <b>S{self.semestre_id}</b> émise par
|
||||
{link}
|
||||
le {self.date.strftime("%d/%m/%Y")} à {self.date.strftime("%Hh%M")}
|
||||
le {self.date.strftime(scu.DATEATIME_FMT)}
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
|
@ -180,9 +180,9 @@ def sidebar(etudid: int = None):
|
||||
)
|
||||
H.append(
|
||||
f"""<span title="absences du {
|
||||
formsemestre.date_debut.strftime("%d/%m/%Y")
|
||||
formsemestre.date_debut.strftime(scu.DATE_FMT)
|
||||
} au {
|
||||
formsemestre.date_fin.strftime("%d/%m/%Y")
|
||||
formsemestre.date_fin.strftime(scu.DATE_FMT)
|
||||
}">({
|
||||
sco_preferences.get_preference("assi_metrique", None)})
|
||||
<br>{nbabsjust:1g} J., {nbabsnj:1g} N.J.</span>"""
|
||||
|
@ -12,6 +12,7 @@ import psycopg2.extras
|
||||
|
||||
from app import log
|
||||
from app.scodoc.sco_exceptions import ScoException, ScoValueError, NoteProcessError
|
||||
from app.scodoc import sco_utils as scu
|
||||
|
||||
quote_html = html.escape
|
||||
|
||||
@ -475,7 +476,7 @@ def DateDMYtoISO(dmy: str, null_is_empty=False) -> str | None:
|
||||
if not isinstance(dmy, str):
|
||||
raise ScoValueError(f'Date (j/m/a) invalide: "{dmy}"')
|
||||
try:
|
||||
dt = datetime.datetime.strptime(dmy, "%d/%m/%Y")
|
||||
dt = datetime.datetime.strptime(dmy, scu.DATE_FMT)
|
||||
except ValueError:
|
||||
try:
|
||||
dt = datetime.datetime.fromisoformat(dmy)
|
||||
|
@ -34,6 +34,7 @@ from app.models.absences import BilletAbsence
|
||||
from app.models.etudiants import Identite
|
||||
from app.scodoc.gen_tables import GenTable
|
||||
from app.scodoc import sco_preferences
|
||||
from app.scodoc import sco_utils as scu
|
||||
|
||||
|
||||
def query_billets_etud(etudid: int = None, etat: bool = None) -> Query:
|
||||
@ -89,12 +90,12 @@ def table_billets(
|
||||
m = " matin"
|
||||
else:
|
||||
m = " après-midi"
|
||||
billet_dict["abs_begin_str"] = billet.abs_begin.strftime("%d/%m/%Y") + m
|
||||
billet_dict["abs_begin_str"] = billet.abs_begin.strftime(scu.DATE_FMT) + m
|
||||
if billet.abs_end.hour < 12:
|
||||
m = " matin"
|
||||
else:
|
||||
m = " après-midi"
|
||||
billet_dict["abs_end_str"] = billet.abs_end.strftime("%d/%m/%Y") + m
|
||||
billet_dict["abs_end_str"] = billet.abs_end.strftime(scu.DATE_FMT) + m
|
||||
if billet.etat == 0:
|
||||
if billet.justified:
|
||||
billet_dict["etat_str"] = "à traiter"
|
||||
|
@ -515,11 +515,13 @@ class ApoEtud(dict):
|
||||
# ne trouve pas de semestre impair
|
||||
self.validation_annee_but = None
|
||||
return
|
||||
self.validation_annee_but: ApcValidationAnnee = ApcValidationAnnee.query.filter_by(
|
||||
self.validation_annee_but: ApcValidationAnnee = (
|
||||
ApcValidationAnnee.query.filter_by(
|
||||
formsemestre_id=formsemestre.id,
|
||||
etudid=self.etud["etudid"],
|
||||
referentiel_competence_id=self.cur_res.formsemestre.formation.referentiel_competence_id,
|
||||
).first()
|
||||
)
|
||||
self.is_nar = (
|
||||
self.validation_annee_but and self.validation_annee_but.code == NAR
|
||||
)
|
||||
@ -1003,7 +1005,7 @@ def comp_apo_sems(etape_apogee, annee_scolaire: int) -> list[dict]:
|
||||
def nar_etuds_table(apo_data, nar_etuds):
|
||||
"""Liste les NAR -> excel table"""
|
||||
code_etape = apo_data.etape_apogee
|
||||
today = datetime.datetime.today().strftime("%d/%m/%y")
|
||||
today = datetime.datetime.today().strftime(scu.DATE_FMT)
|
||||
rows = []
|
||||
nar_etuds.sort(key=lambda k: k["nom"])
|
||||
for e in nar_etuds:
|
||||
|
@ -98,7 +98,7 @@ def do_formsemestre_archive(
|
||||
archive_id = PV_ARCHIVER.create_obj_archive(
|
||||
sem_archive_id, description, formsemestre.dept_id
|
||||
)
|
||||
date = PV_ARCHIVER.get_archive_date(archive_id).strftime("%d/%m/%Y à %H:%M")
|
||||
date = PV_ARCHIVER.get_archive_date(archive_id).strftime(scu.DATEATIME_FMT)
|
||||
|
||||
if not group_ids:
|
||||
# tous les inscrits du semestre
|
||||
|
@ -126,7 +126,7 @@ def make_context_dict(formsemestre: FormSemestre, etud: dict) -> dict:
|
||||
|
||||
# ajoute date courante
|
||||
t = time.localtime()
|
||||
C["date_dmy"] = time.strftime("%d/%m/%Y", t)
|
||||
C["date_dmy"] = time.strftime(scu.DATE_FMT, t)
|
||||
C["date_iso"] = time.strftime("%Y-%m-%d", t)
|
||||
|
||||
return C
|
||||
|
@ -352,7 +352,7 @@ class BulletinGeneratorLegacy(sco_bulletins_generator.BulletinGenerator):
|
||||
H.append(
|
||||
f"""<p>
|
||||
<span class="bull_appreciations_date">{
|
||||
appreciation.date.strftime("%d/%m/%y") if appreciation.date else ""
|
||||
appreciation.date.strftime(scu.DATE_FMT) if appreciation.date else ""
|
||||
}</span>
|
||||
{appreciation.comment_safe()}
|
||||
<span class="bull_appreciations_link">{mlink}</span>
|
||||
|
@ -182,7 +182,7 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
|
||||
H.append(
|
||||
f"""<p>
|
||||
<span class="bull_appreciations_date">{
|
||||
appreciation.date.strftime("%d/%m/%Y")
|
||||
appreciation.date.strftime(scu.DATE_FMT)
|
||||
if appreciation.date else ""}</span>
|
||||
{appreciation.comment_safe()}
|
||||
<span class="bull_appreciations_link">{mlink}</span>
|
||||
|
@ -29,7 +29,6 @@
|
||||
"""
|
||||
|
||||
import calendar
|
||||
import datetime
|
||||
import html
|
||||
import time
|
||||
|
||||
@ -357,7 +356,7 @@ def MonthTableBody(
|
||||
if not halfday:
|
||||
for d in range(1, nbdays + 1):
|
||||
weeknum = time.strftime(
|
||||
"%U", time.strptime("%d/%d/%d" % (d, month, year), "%d/%m/%Y")
|
||||
"%U", time.strptime("%d/%d/%d" % (d, month, year), scu.DATE_FMT)
|
||||
)
|
||||
day = DAYNAMES_ABREV[(firstday + d - 1) % 7]
|
||||
if day in weekend:
|
||||
@ -432,7 +431,7 @@ def MonthTableBody(
|
||||
# Calendar with 2 cells / day
|
||||
for d in range(1, nbdays + 1):
|
||||
weeknum = time.strftime(
|
||||
"%U", time.strptime("%d/%d/%d" % (d, month, year), "%d/%m/%Y")
|
||||
"%U", time.strptime("%d/%d/%d" % (d, month, year), scu.DATE_FMT)
|
||||
)
|
||||
day = DAYNAMES_ABREV[(firstday + d - 1) % 7]
|
||||
if day in weekend:
|
||||
|
@ -478,11 +478,11 @@ def convert_ics(
|
||||
"heure_deb": event.decoded("dtstart")
|
||||
.replace(tzinfo=timezone.utc)
|
||||
.astimezone(tz=None)
|
||||
.strftime("%H:%M"),
|
||||
.strftime(scu.TIME_FMT),
|
||||
"heure_fin": event.decoded("dtend")
|
||||
.replace(tzinfo=timezone.utc)
|
||||
.astimezone(tz=None)
|
||||
.strftime("%H:%M"),
|
||||
.strftime(scu.TIME_FMT),
|
||||
"jour": event.decoded("dtstart").date().isoformat(),
|
||||
"start": event.decoded("dtstart").isoformat(),
|
||||
"end": event.decoded("dtend").isoformat(),
|
||||
|
@ -452,7 +452,7 @@ def table_apo_csv_list(semset):
|
||||
apo_data = sco_apogee_csv.ApoData(csv_data, periode=semset["sem_id"])
|
||||
t["filename"] = apo_data.apo_csv.titles["apoC_Fichier_Exp"]
|
||||
t["nb_etuds"] = len(apo_data.etuds)
|
||||
t["date_str"] = t["date"].strftime("%d/%m/%Y à %H:%M")
|
||||
t["date_str"] = t["date"].strftime(scu.DATEATIME_FMT)
|
||||
view_link = url_for(
|
||||
"notes.view_apo_csv",
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
|
@ -135,7 +135,7 @@ def evaluation_check_absences_html(
|
||||
f"""<h2 class="eval_check_absences">{
|
||||
evaluation.description or "évaluation"
|
||||
} du {
|
||||
evaluation.date_debut.strftime("%d/%m/%Y") if evaluation.date_debut else ""
|
||||
evaluation.date_debut.strftime(scu.DATE_FMT) if evaluation.date_debut else ""
|
||||
} """
|
||||
]
|
||||
if (
|
||||
|
@ -90,7 +90,7 @@ def evaluation_create_form(
|
||||
raise ValueError("missing moduleimpl_id parameter")
|
||||
numeros = [(e.numero or 0) for e in modimpl.evaluations]
|
||||
initvalues = {
|
||||
"jour": time.strftime("%d/%m/%Y", time.localtime()),
|
||||
"jour": time.strftime(scu.DATE_FMT, time.localtime()),
|
||||
"note_max": 20,
|
||||
"numero": (max(numeros) + 1) if numeros else 0,
|
||||
"publish_incomplete": is_malus,
|
||||
@ -144,7 +144,7 @@ def evaluation_create_form(
|
||||
if edit:
|
||||
initvalues["blocked"] = evaluation.is_blocked()
|
||||
initvalues["blocked_until"] = (
|
||||
evaluation.blocked_until.strftime("%d/%m/%Y")
|
||||
evaluation.blocked_until.strftime(scu.DATE_FMT)
|
||||
if evaluation.blocked_until
|
||||
and evaluation.blocked_until < Evaluation.BLOCKED_FOREVER
|
||||
else ""
|
||||
@ -405,7 +405,7 @@ def evaluation_create_form(
|
||||
if args.get("blocked_until"):
|
||||
try:
|
||||
args["blocked_until"] = datetime.datetime.strptime(
|
||||
args["blocked_until"], "%d/%m/%Y"
|
||||
args["blocked_until"], scu.DATE_FMT
|
||||
)
|
||||
except ValueError as exc:
|
||||
raise ScoValueError("Date déblocage (j/m/a) invalide") from exc
|
||||
|
@ -126,13 +126,15 @@ def evaluations_recap_table(formsemestre: FormSemestre) -> list[dict]:
|
||||
evaluation_id=evaluation_id,
|
||||
),
|
||||
"_titre_target_attrs": 'class="discretelink"',
|
||||
"date": e.date_debut.strftime("%d/%m/%Y") if e.date_debut else "",
|
||||
"date": e.date_debut.strftime(scu.DATE_FMT) if e.date_debut else "",
|
||||
"_date_order": e.date_debut.isoformat() if e.date_debut else "",
|
||||
"complete": "oui" if eval_etat.is_complete else "non",
|
||||
"_complete_target": "#",
|
||||
"_complete_target_attrs": 'class="bull_link" title="prise en compte dans les moyennes"'
|
||||
"_complete_target_attrs": (
|
||||
'class="bull_link" title="prise en compte dans les moyennes"'
|
||||
if eval_etat.is_complete
|
||||
else 'class="bull_link incomplete" title="il manque des notes"',
|
||||
else 'class="bull_link incomplete" title="il manque des notes"'
|
||||
),
|
||||
"manquantes": len(modimpl_results.evals_etudids_sans_note[e.id]),
|
||||
"inscrits": modimpl_results.nb_inscrits_module,
|
||||
"nb_abs": sum(modimpl_results.evals_notes[e.id] == scu.NOTES_ABSENCE),
|
||||
|
@ -381,8 +381,10 @@ def formsemestre_evaluations_cal(formsemestre_id):
|
||||
if e.date_debut == e.date_fin:
|
||||
heure_debut_txt, heure_fin_txt = "?", "?"
|
||||
else:
|
||||
heure_debut_txt = e.date_debut.strftime("%Hh%M") if e.date_debut else "?"
|
||||
heure_fin_txt = e.date_fin.strftime("%Hh%M") if e.date_fin else "?"
|
||||
heure_debut_txt = (
|
||||
e.date_debut.strftime(scu.TIME_FMT) if e.date_debut else "?"
|
||||
)
|
||||
heure_fin_txt = e.date_fin.strftime(scu.TIME_FMT) if e.date_fin else "?"
|
||||
|
||||
description = f"""{
|
||||
e.moduleimpl.module.titre
|
||||
@ -526,7 +528,7 @@ def formsemestre_evaluations_delai_correction(formsemestre_id, fmt="html"):
|
||||
"date_first_complete": date_first_complete,
|
||||
"delai_correction": delai_correction,
|
||||
"jour": (
|
||||
e.date_debut.strftime("%d/%m/%Y") if e.date_debut else "sans date"
|
||||
e.date_debut.strftime(scu.DATE_FMT) if e.date_debut else "sans date"
|
||||
),
|
||||
"_jour_target": url_for(
|
||||
"notes.evaluation_listenotes",
|
||||
|
@ -72,7 +72,7 @@ def xldate_as_datetime(xldate, datemode=0):
|
||||
Peut lever une ValueError
|
||||
"""
|
||||
try:
|
||||
return datetime.datetime.strptime(xldate, "%d/%m/%Y")
|
||||
return datetime.datetime.strptime(xldate, scu.DATE_FMT)
|
||||
except:
|
||||
return openpyxl.utils.datetime.from_ISO8601(xldate)
|
||||
|
||||
|
@ -521,7 +521,7 @@ def _record_ue_validations_and_coefs(
|
||||
coef = _convert_field_to_float(coef)
|
||||
if coef == "" or coef is False:
|
||||
coef = None
|
||||
now_dmy = time.strftime("%d/%m/%Y")
|
||||
now_dmy = time.strftime(scu.DATE_FMT)
|
||||
log(
|
||||
f"_record_ue_validations_and_coefs: {formsemestre.id} etudid={etud.id} ue_id={ue.id} moy_ue={note} ue_coef={coef}"
|
||||
)
|
||||
|
@ -106,7 +106,7 @@ def do_formsemestre_inscription_create(args, method=None):
|
||||
cnx,
|
||||
args={
|
||||
"etudid": args["etudid"],
|
||||
"event_date": time.strftime("%d/%m/%Y"),
|
||||
"event_date": time.strftime(scu.DATE_FMT),
|
||||
"formsemestre_id": args["formsemestre_id"],
|
||||
"event_type": "INSCRIPTION",
|
||||
},
|
||||
|
@ -64,14 +64,11 @@ from app.scodoc import sco_archives_formsemestre
|
||||
from app.scodoc import sco_bulletins
|
||||
from app.scodoc import codes_cursus
|
||||
from app.scodoc import sco_compute_moy
|
||||
from app.scodoc import sco_edit_ue
|
||||
from app.scodoc import sco_evaluations
|
||||
from app.scodoc import sco_evaluation_db
|
||||
from app.scodoc import sco_formations
|
||||
from app.scodoc import sco_formsemestre
|
||||
from app.scodoc import sco_formsemestre_inscriptions
|
||||
from app.scodoc import sco_groups
|
||||
from app.scodoc import sco_moduleimpl
|
||||
from app.scodoc import sco_preferences
|
||||
from app.scodoc import sco_users
|
||||
from app.scodoc.gen_tables import GenTable
|
||||
@ -692,7 +689,7 @@ def formsemestre_description_table(
|
||||
)
|
||||
e["_date_evaluation_order"] = e["jour"].isoformat()
|
||||
e["date_evaluation"] = (
|
||||
e["jour"].strftime("%d/%m/%Y") if e["jour"] else ""
|
||||
e["jour"].strftime(scu.DATE_FMT) if e["jour"] else ""
|
||||
)
|
||||
e["UE"] = row["UE"]
|
||||
e["_UE_td_attrs"] = row["_UE_td_attrs"]
|
||||
|
@ -1160,7 +1160,7 @@ def formsemestre_validate_previous_ue(formsemestre: FormSemestre, etud: Identite
|
||||
"input_type": "date",
|
||||
"size": 9,
|
||||
"explanation": "j/m/a",
|
||||
"default": time.strftime("%d/%m/%Y"),
|
||||
"default": time.strftime(scu.DATE_FMT),
|
||||
},
|
||||
),
|
||||
(
|
||||
|
@ -513,7 +513,7 @@ def _build_page(
|
||||
|
||||
<div>{scu.EMO_WARNING}
|
||||
<em>Seuls les semestres dont la date de fin est proche de la date de début
|
||||
de ce semestre ({formsemestre.date_debut.strftime("%d/%m/%Y")}) sont pris en
|
||||
de ce semestre ({formsemestre.date_debut.strftime(scu.DATE_FMT)}) sont pris en
|
||||
compte.</em>
|
||||
</div>
|
||||
{etuds_select_boxes(auth_etuds_by_sem, inscrits_ailleurs)}
|
||||
@ -704,7 +704,7 @@ def etuds_select_boxes(
|
||||
elink += (
|
||||
'<span class="finalisationinscription">'
|
||||
+ " : inscription finalisée le "
|
||||
+ etud["datefinalisationinscription"].strftime("%d/%m/%Y")
|
||||
+ etud["datefinalisationinscription"].strftime(scu.DATE_FMT)
|
||||
+ "</span>"
|
||||
)
|
||||
|
||||
|
@ -827,7 +827,7 @@ def _add_eval_columns(
|
||||
nb_notes,
|
||||
evaluation.description,
|
||||
(
|
||||
evaluation.date_debut.strftime("%d/%m/%Y")
|
||||
evaluation.date_debut.strftime(scu.DATE_FMT)
|
||||
if evaluation.date_debut
|
||||
else ""
|
||||
),
|
||||
|
@ -50,8 +50,6 @@ from app.scodoc import html_sco_header
|
||||
from app.scodoc import htmlutils
|
||||
from app.scodoc import sco_cache
|
||||
from app.scodoc import codes_cursus
|
||||
from app.scodoc import sco_edit_module
|
||||
from app.scodoc import sco_edit_ue
|
||||
from app.scodoc import sco_etud
|
||||
from app.scodoc import sco_formsemestre_inscriptions
|
||||
from app.scodoc import sco_groups
|
||||
@ -431,7 +429,7 @@ def moduleimpl_inscriptions_stats(formsemestre_id):
|
||||
)
|
||||
if info["ue_status"]["event_date"]:
|
||||
H.append(
|
||||
f"""(cap. le {info["ue_status"]["event_date"].strftime("%d/%m/%Y")})"""
|
||||
f"""(cap. le {info["ue_status"]["event_date"].strftime(scu.DATE_FMT)})"""
|
||||
)
|
||||
if is_apc:
|
||||
is_inscrit_ue = (etud.id, ue.id) not in res.dispense_ues
|
||||
@ -584,7 +582,7 @@ def _list_but_ue_inscriptions(res: NotesTableCompat, read_only: bool = True) ->
|
||||
validation = validations_ue[-1] if validations_ue else None
|
||||
expl_validation = (
|
||||
f"""Validée ({validation.code}) le {
|
||||
validation.event_date.strftime("%d/%m/%Y")}"""
|
||||
validation.event_date.strftime(scu.DATE_FMT)}"""
|
||||
if validation
|
||||
else ""
|
||||
)
|
||||
|
@ -28,7 +28,6 @@
|
||||
"""Tableau de bord module"""
|
||||
|
||||
import math
|
||||
import time
|
||||
import datetime
|
||||
|
||||
from flask import g, url_for
|
||||
@ -48,13 +47,10 @@ from app.scodoc.sco_permissions import Permission
|
||||
|
||||
from app.scodoc import html_sco_header
|
||||
from app.scodoc import htmlutils
|
||||
from app.scodoc import sco_cal
|
||||
from app.scodoc import sco_compute_moy
|
||||
from app.scodoc import sco_evaluations
|
||||
from app.scodoc import sco_formsemestre_status
|
||||
from app.scodoc import sco_groups
|
||||
from app.scodoc import sco_moduleimpl
|
||||
from app.scodoc import sco_permissions_check
|
||||
from app.tables import list_etuds
|
||||
|
||||
|
||||
@ -262,7 +258,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
||||
# 2ieme ligne: Semestre, Coef
|
||||
H.append("""<tr><td class="fichetitre2">""")
|
||||
if formsemestre.semestre_id >= 0:
|
||||
H.append("""Semestre: </td><td>%s""" % formsemestre.semestre_id)
|
||||
H.append(f"""Semestre: </td><td>{formsemestre.semestre_id}""")
|
||||
else:
|
||||
H.append("""</td><td>""")
|
||||
if sem_locked:
|
||||
@ -290,7 +286,8 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
||||
)
|
||||
if current_user.has_permission(Permission.EtudInscrit):
|
||||
H.append(
|
||||
f"""<a class="stdlink" style="margin-left:2em;" href="moduleimpl_inscriptions_edit?moduleimpl_id={modimpl.id}">modifier</a>"""
|
||||
f"""<a class="stdlink" style="margin-left:2em;"
|
||||
href="moduleimpl_inscriptions_edit?moduleimpl_id={modimpl.id}">modifier</a>"""
|
||||
)
|
||||
H.append("</td></tr>")
|
||||
# Ligne: règle de calcul
|
||||
@ -614,7 +611,7 @@ def _ligne_evaluation(
|
||||
|
||||
if evaluation.is_blocked():
|
||||
etat_txt = f"""évaluation bloquée {
|
||||
"jusqu'au " + evaluation.blocked_until.strftime("%d/%m/%Y")
|
||||
"jusqu'au " + evaluation.blocked_until.strftime(scu.DATE_FMT)
|
||||
if evaluation.blocked_until < Evaluation.BLOCKED_FOREVER
|
||||
else "" }
|
||||
"""
|
||||
@ -657,7 +654,8 @@ def _ligne_evaluation(
|
||||
<th class="moduleimpl_evaluations">Notes</th>
|
||||
<th class="moduleimpl_evaluations">Abs</th>
|
||||
<th class="moduleimpl_evaluations">N</th>
|
||||
<th class="moduleimpl_evaluations moduleimpl_evaluation_moy" colspan="2"><span>{etat_txt}</span></th>
|
||||
<th class="moduleimpl_evaluations moduleimpl_evaluation_moy"
|
||||
colspan="2"><span>{etat_txt}</span></th>
|
||||
</tr>
|
||||
<tr class="{tr_class} mievr_in">
|
||||
<td class="mievr">"""
|
||||
|
@ -730,7 +730,7 @@ def get_html_annotations_list(etud: Identite) -> list[str]:
|
||||
author = User.query.filter_by(user_name=annot.author).first()
|
||||
html_annotations_list.append(
|
||||
f"""<tr><td><span class="annodate">Le {
|
||||
annot.date.strftime("%d/%m/%Y") if annot.date else "?"}
|
||||
annot.date.strftime(scu.DATE_FMT) if annot.date else "?"}
|
||||
par {author.get_prenomnom() if author else "?"} :
|
||||
</span><span class="annoc">{annot.comment or ""}</span></td>{del_link}</tr>
|
||||
"""
|
||||
|
@ -335,7 +335,7 @@ class PlacementRunner:
|
||||
|
||||
def _production_pdf(self):
|
||||
pdf_title = "<br>".join(self.desceval)
|
||||
pdf_title += f"""\nDate : {self.evaluation.date_debut.strftime("%d/%m/%Y")
|
||||
pdf_title += f"""\nDate : {self.evaluation.date_debut.strftime(scu.DATE_FMT)
|
||||
if self.evaluation.date_debut else '-'
|
||||
} - Horaire : {self.evaluation.heure_debut()} à {self.evaluation.heure_fin()
|
||||
}"""
|
||||
@ -485,7 +485,7 @@ class PlacementRunner:
|
||||
worksheet.append_blank_row()
|
||||
worksheet.append_single_cell_row(desceval, self.styles["titres"])
|
||||
worksheet.append_single_cell_row(
|
||||
f"""Date : {self.evaluation.date_debut.strftime("%d/%m/%Y")
|
||||
f"""Date : {self.evaluation.date_debut.strftime(scu.DATE_FMT)
|
||||
if self.evaluation.date_debut else '-'
|
||||
} - Horaire : {self.evaluation.heure_debut()} à {self.evaluation.heure_fin()
|
||||
}""",
|
||||
|
@ -517,7 +517,7 @@ def _normalize_apo_fields(infolist):
|
||||
)
|
||||
infos["datefinalisationinscription_str"] = infos[
|
||||
"datefinalisationinscription"
|
||||
].strftime("%d/%m/%Y")
|
||||
].strftime(scu.DATE_FMT)
|
||||
else:
|
||||
infos["datefinalisationinscription"] = None
|
||||
infos["datefinalisationinscription_str"] = ""
|
||||
|
@ -327,7 +327,7 @@ def feuille_preparation_jury(formsemestre_id):
|
||||
"Préparé par %s le %s sur %s pour %s"
|
||||
% (
|
||||
sco_version.SCONAME,
|
||||
time.strftime("%d/%m/%Y"),
|
||||
time.strftime(scu.DATE_FMT),
|
||||
request.url_root,
|
||||
current_user,
|
||||
)
|
||||
|
@ -670,8 +670,8 @@ def table_suivi_cohorte(
|
||||
L.append(l)
|
||||
|
||||
columns_ids = [p.datedebut for p in P]
|
||||
titles = dict([(p.datedebut, p.datedebut.strftime("%d/%m/%y")) for p in P])
|
||||
titles[porigin.datedebut] = porigin.datedebut.strftime("%d/%m/%y")
|
||||
titles = dict([(p.datedebut, p.datedebut.strftime(scu.DATE_FMT)) for p in P])
|
||||
titles[porigin.datedebut] = porigin.datedebut.strftime(scu.DATE_FMT)
|
||||
if percent:
|
||||
pp = "(en % de la population initiale) "
|
||||
titles["row_title"] = "%"
|
||||
@ -717,7 +717,7 @@ def table_suivi_cohorte(
|
||||
else:
|
||||
expl = ["<h3>Semestres associés à chaque date:</h3><ul>"]
|
||||
for p in P:
|
||||
expl.append(f"""<li><b>{p.datedebut.strftime("%d/%m/%y")}</b>:""")
|
||||
expl.append(f"""<li><b>{p.datedebut.strftime(scu.DATE_FMT)}</b>:""")
|
||||
ls = []
|
||||
for s in p.sems:
|
||||
ls.append(formsemestre.html_link_status())
|
||||
|
@ -892,7 +892,7 @@ def feuille_saisie_notes(evaluation_id, group_ids=[]):
|
||||
eval_name = f"{evaluation.moduleimpl.module.code}-{indication_date}"
|
||||
|
||||
date_str = (
|
||||
f"""du {evaluation.date_debut.strftime("%d/%m/%Y")}"""
|
||||
f"""du {evaluation.date_debut.strftime(scu.DATE_FMT)}"""
|
||||
if evaluation.date_debut
|
||||
else "(sans date)"
|
||||
)
|
||||
|
@ -117,7 +117,7 @@ def convert_fr_date(date_str: str, allow_iso=True) -> datetime.datetime:
|
||||
ScoValueError si date invalide.
|
||||
"""
|
||||
try:
|
||||
return datetime.datetime.strptime(date_str, "%d/%m/%Y")
|
||||
return datetime.datetime.strptime(date_str, DATE_FMT)
|
||||
except ValueError:
|
||||
# Try to add century ?
|
||||
m = re.match(r"^(\d{1,2})/(\d{1,2})/(\d\d)$", date_str)
|
||||
@ -129,7 +129,7 @@ def convert_fr_date(date_str: str, allow_iso=True) -> datetime.datetime:
|
||||
year += 1900
|
||||
try:
|
||||
return datetime.datetime.strptime(
|
||||
f"{m.group(1)}/{m.group(2)}/{year}", "%d/%m/%Y"
|
||||
f"{m.group(1)}/{m.group(2)}/{year}", DATE_FMT
|
||||
)
|
||||
except ValueError:
|
||||
pass
|
||||
@ -550,6 +550,11 @@ MONTH_NAMES = (
|
||||
)
|
||||
DAY_NAMES = ("lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi", "dimanche")
|
||||
|
||||
TIME_FMT = "%H:%M" # affichage des heures
|
||||
DATE_FMT = "%d/%m/%Y" # affichage des dates
|
||||
DATEATIME_FMT = DATE_FMT + " à " + DATE_FMT
|
||||
DATETIME_FMT = DATE_FMT + " " + DATE_FMT
|
||||
|
||||
|
||||
def fmt_note(val, note_max=None, keep_numeric=False):
|
||||
"""conversion note en str pour affichage dans tables HTML ou PDF.
|
||||
@ -1067,9 +1072,9 @@ def bul_filename(formsemestre, etud, prefix="bul"):
|
||||
|
||||
def flash_errors(form):
|
||||
"""Flashes form errors (version sommaire)"""
|
||||
for field, errors in form.errors.items():
|
||||
for field, _ in form.errors.items():
|
||||
flash(
|
||||
"Erreur: voir le champ %s" % (getattr(form, field).label.text,),
|
||||
f"Erreur: voir le champ {getattr(form, field).label.text}",
|
||||
"warning",
|
||||
)
|
||||
# see https://getbootstrap.com/docs/4.0/components/alerts/
|
||||
|
@ -13,6 +13,8 @@ from sqlalchemy import desc, literal, union, asc
|
||||
from app import db, g
|
||||
from app.auth.models import User
|
||||
from app.models import Assiduite, Identite, Justificatif, Module
|
||||
import app.scodoc.sco_utils as scu
|
||||
|
||||
from app.scodoc.sco_utils import (
|
||||
EtatAssiduite,
|
||||
EtatJustificatif,
|
||||
@ -401,8 +403,8 @@ class RowAssiJusti(tb.Row):
|
||||
]
|
||||
|
||||
if multi_days and self.ligne["type"] != "justificatif":
|
||||
date_affichees[0] = self.ligne["date_debut"].strftime("%d/%m/%y")
|
||||
date_affichees[1] = self.ligne["date_fin"].strftime("%d/%m/%y")
|
||||
date_affichees[0] = self.ligne["date_debut"].strftime(scu.DATE_FMT)
|
||||
date_affichees[1] = self.ligne["date_fin"].strftime(scu.DATE_FMT)
|
||||
|
||||
self.add_cell(
|
||||
"date_debut",
|
||||
@ -443,7 +445,7 @@ class RowAssiJusti(tb.Row):
|
||||
"entry_date",
|
||||
"Saisie le",
|
||||
(
|
||||
self.ligne["entry_date"].strftime("%d/%m/%y à %H:%M")
|
||||
self.ligne["entry_date"].strftime(scu.DATEATIME_FMT)
|
||||
if self.ligne["entry_date"]
|
||||
else "?"
|
||||
),
|
||||
|
@ -386,7 +386,7 @@ class TableRecap(tb.Table):
|
||||
for e in evals:
|
||||
col_id = f"eval_{e.id}"
|
||||
title = f"""{modimpl.module.code} {eval_index} {
|
||||
e.date_debut.strftime("%d/%m/%Y") if e.date_debut else ""
|
||||
e.date_debut.strftime(scu.DATE_FMT) if e.date_debut else ""
|
||||
}"""
|
||||
col_classes = []
|
||||
if first_eval:
|
||||
|
@ -48,7 +48,7 @@ div.submit > input {
|
||||
{% if justif %}
|
||||
<div class="info-saisie">
|
||||
Saisie par {{justif.user.get_prenomnom() if justif.user else "inconnu"}}
|
||||
le {{justif.entry_date.strftime("%d/%m/%Y à %H:%M") if justif.entry_date else "?"}}
|
||||
le {{justif.entry_date.strftime(scu.DATEATIME_FMT) if justif.entry_date else "?"}}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
@ -10,8 +10,8 @@
|
||||
{% block app_content %}
|
||||
<div class="tab-content">
|
||||
|
||||
<h2>Présence du groupe {{group_title}} le {{date_debut.strftime("%d/%m/%Y")}}
|
||||
de {{date_debut.strftime("%H:%M")}} à {{date_fin.strftime("%H:%M")}}
|
||||
<h2>Présence du groupe {{group_title}} le {{date_debut.strftime(scu.DATE_FMT)}}
|
||||
de {{date_debut.strftime(scu.TIME_FMT)}} à {{date_fin.strftime(scu.TIME_FMT)}}
|
||||
</h2>
|
||||
|
||||
<div>
|
||||
|
@ -326,15 +326,15 @@ main();
|
||||
<div class="plage">
|
||||
{% if ligne.justif.date_debut.date() == ligne.justif.date_fin.date() %}
|
||||
<span class="date">
|
||||
{{ligne.justif.date_debut.strftime("%d/%m/%y")}} de {{ligne.justif.date_debut.strftime("%Hh%M")}} à
|
||||
{{ligne.justif.date_fin.strftime("%Hh%M")}}
|
||||
{{ligne.justif.date_debut.strftime(scu.DATE_FMT)}} de {{ligne.justif.date_debut.strftime(scu.TIME_FMT)}} à
|
||||
{{ligne.justif.date_fin.strftime(scu.TIME_FMT)}}
|
||||
</span>
|
||||
{% else %}
|
||||
<span class="date_debut">
|
||||
du {{ligne.justif.date_debut.strftime("%d/%m/%y")}}
|
||||
du {{ligne.justif.date_debut.strftime(scu.DATE_FMT)}}
|
||||
</span>
|
||||
<span class="date_fin">
|
||||
au {{ligne.justif.date_fin.strftime("%d/%m/%y")}}
|
||||
au {{ligne.justif.date_fin.strftime(scu.DATE_FMT)}}
|
||||
</span>
|
||||
{% endif %}
|
||||
<span class="entry_date hint">
|
||||
@ -352,8 +352,8 @@ main();
|
||||
<li>
|
||||
{{scu.EtatAssiduite(assi.etat).version_lisible()}}
|
||||
{% if assi.date_debut.date() == assi.date_fin.date() %}
|
||||
du {{assi.date_debut.strftime("%d/%m/%y")}} de {{assi.date_debut.strftime("%Hh%M")}} à
|
||||
{{assi.date_fin.strftime("%Hh%M")}}
|
||||
du {{assi.date_debut.strftime(scu.DATE_FMT)}} de {{assi.date_debut.strftime(scu.TIME_FMT)}} à
|
||||
{{assi.date_fin.strftime(scu.TIME_FMT)}}
|
||||
{% else %}
|
||||
du {{assi.date_debut.strftime("%d/%m/%y %Hh%M")}} au {{assi.date_fin.strftime("%d/%m/%y
|
||||
%Hh%M")}}
|
||||
|
@ -30,15 +30,15 @@
|
||||
</div>
|
||||
{% if current_user.is_administrator() %}
|
||||
<div class="user_info_admin">
|
||||
<b>Dernière vue :</b> {{user.last_seen.strftime("%d/%m/%Y à %H:%M") if user.last_seen else "-"}}<br>
|
||||
<b>Dernière connexion CAS :</b> {{user.cas_last_login.strftime("%d/%m/%Y à %H:%M") if user.cas_last_login else "-"}}<br>
|
||||
<b>Dernière vue :</b> {{user.last_seen.strftime(scu.DATEATIME_FMT) if user.last_seen else "-"}}<br>
|
||||
<b>Dernière connexion CAS :</b> {{user.cas_last_login.strftime(scu.DATEATIME_FMT) if user.cas_last_login else "-"}}<br>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="user_basics">
|
||||
<b>Dernière modif mot de passe:</b>
|
||||
{{user.date_modif_passwd.strftime("%d/%m/%Y") if user.date_modif_passwd else ""}}<br>
|
||||
{{user.date_modif_passwd.strftime(scu.DATE_FMT) if user.date_modif_passwd else ""}}<br>
|
||||
<b>Date d'expiration:</b>
|
||||
{{user.date_expiration.strftime("%d/%m/%Y") if user.date_expiration else "(sans limite)"}}
|
||||
{{user.date_expiration.strftime(scu.DATE_FMT) if user.date_expiration else "(sans limite)"}}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
@ -134,7 +134,7 @@
|
||||
<div class="descr_jury">
|
||||
{% if bul.semestre.decision_annee %}
|
||||
Décision saisie le {{
|
||||
datetime.datetime.fromisoformat(bul.semestre.decision_annee.date).strftime("%d/%m/%Y")
|
||||
datetime.datetime.fromisoformat(bul.semestre.decision_annee.date).strftime(scu.DATE_FMT)
|
||||
}},
|
||||
année <b>BUT{{bul.semestre.decision_annee.ordre}}</b>
|
||||
<b>{{bul.semestre.decision_annee.code}}</b>.
|
||||
|
@ -18,7 +18,7 @@
|
||||
<div>{{validation.ue1.acronyme}} - {{validation.ue2.acronyme}}</div>
|
||||
<div>Jury de {{validation.formsemestre.titre_annee() if validation.formsemestre else "-"}}</div>
|
||||
<div>enregistré le {{
|
||||
validation.date.strftime("%d/%m/%Y à %H:%M")
|
||||
validation.date.strftime(scu.DATEATIME_FMT)
|
||||
}}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -9,7 +9,7 @@
|
||||
<h2>Référentiel de compétences {{ref.type_titre}} {{ref.specialite_long}}</h2>
|
||||
|
||||
<div class="help">
|
||||
Référentiel chargé le {{ref.scodoc_date_loaded.strftime("%d/%m/%Y à %H:%M") if ref.scodoc_date_loaded else ""}} à
|
||||
Référentiel chargé le {{ref.scodoc_date_loaded.strftime(scu.DATEATIME_FMT) if ref.scodoc_date_loaded else ""}} à
|
||||
partir du fichier <tt>{{ref.scodoc_orig_filename or "(inconnu)"}}</tt>.
|
||||
</div>
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
<div>Jury de {{validation.formsemestre.titre_annee()
|
||||
if validation.formsemestre else "-"}}</div>
|
||||
<div>enregistrée le {{
|
||||
validation.event_date.strftime("%d/%m/%Y à %H:%M")
|
||||
validation.event_date.strftime(scu.DATEATIME_FMT)
|
||||
if validation.event_date else "-"
|
||||
}}</div>
|
||||
<div>{{"%g"|format(validation.ects())}} ECTS</div>
|
||||
@ -116,7 +116,7 @@
|
||||
<div class="scoplement">
|
||||
<div>Validation du RCUE</div>
|
||||
<div>enregistrée le {{
|
||||
validation.date.strftime("%d/%m/%Y à %H:%M")
|
||||
validation.date.strftime(scu.DATEATIME_FMT)
|
||||
if validation.date else "-"
|
||||
}}
|
||||
</div>
|
||||
|
@ -313,13 +313,13 @@ def _get_dates_from_assi_form(
|
||||
date_fin = None
|
||||
# On commence par convertir individuellement tous les champs
|
||||
try:
|
||||
date_debut = datetime.datetime.strptime(form.date_debut.data, "%d/%m/%Y")
|
||||
date_debut = datetime.datetime.strptime(form.date_debut.data, scu.DATE_FMT)
|
||||
except ValueError:
|
||||
date_debut = None
|
||||
form.set_error("date début invalide", form.date_debut)
|
||||
try:
|
||||
date_fin = (
|
||||
datetime.datetime.strptime(form.date_fin.data, "%d/%m/%Y")
|
||||
datetime.datetime.strptime(form.date_fin.data, scu.DATE_FMT)
|
||||
if form.date_fin.data
|
||||
else None
|
||||
)
|
||||
@ -358,7 +358,7 @@ def _get_dates_from_assi_form(
|
||||
# La date de dépôt (si vide, la date actuelle)
|
||||
try:
|
||||
dt_entry_date = (
|
||||
datetime.datetime.strptime(form.entry_date.data, "%d/%m/%Y")
|
||||
datetime.datetime.strptime(form.entry_date.data, scu.DATE_FMT)
|
||||
if form.entry_date.data
|
||||
else datetime.datetime.now() # local tz
|
||||
)
|
||||
@ -573,8 +573,8 @@ def bilan_etud():
|
||||
abort(404, "étudiant inexistant dans ce département")
|
||||
|
||||
# Gestion des dates du bilan (par défaut l'année scolaire)
|
||||
date_debut = scu.date_debut_annee_scolaire().strftime("%d/%m/%Y")
|
||||
date_fin: str = scu.date_fin_annee_scolaire().strftime("%d/%m/%Y")
|
||||
date_debut = scu.date_debut_annee_scolaire().strftime(scu.DATE_FMT)
|
||||
date_fin: str = scu.date_fin_annee_scolaire().strftime(scu.DATE_FMT)
|
||||
|
||||
# Récupération de la métrique d'assiduité
|
||||
assi_metric = scu.translate_assiduites_metric(
|
||||
@ -634,18 +634,18 @@ def edit_justificatif_etud(justif_id: int):
|
||||
form = AjoutJustificatifEtudForm(obj=justif)
|
||||
# Set the default value for the etat field
|
||||
if request.method == "GET":
|
||||
form.date_debut.data = justif.date_debut.strftime("%d/%m/%Y")
|
||||
form.date_fin.data = justif.date_fin.strftime("%d/%m/%Y")
|
||||
form.date_debut.data = justif.date_debut.strftime(scu.DATE_FMT)
|
||||
form.date_fin.data = justif.date_fin.strftime(scu.DATE_FMT)
|
||||
if form.date_fin.data == form.date_debut.data:
|
||||
# un seul jour: pas de date de fin, indique les heures
|
||||
form.date_fin.data = ""
|
||||
form.heure_debut.data = justif.date_debut.strftime("%H:%M")
|
||||
form.heure_fin.data = justif.date_fin.strftime("%H:%M")
|
||||
form.heure_debut.data = justif.date_debut.strftime(scu.TIME_FMT)
|
||||
form.heure_fin.data = justif.date_fin.strftime(scu.TIME_FMT)
|
||||
form.entry_date.data = (
|
||||
justif.entry_date.strftime("%d/%m/%Y") if justif.entry_date else ""
|
||||
justif.entry_date.strftime(scu.DATE_FMT) if justif.entry_date else ""
|
||||
)
|
||||
form.entry_time.data = (
|
||||
justif.entry_date.strftime("%H:%M") if justif.entry_date else ""
|
||||
justif.entry_date.strftime(scu.TIME_FMT) if justif.entry_date else ""
|
||||
)
|
||||
form.etat.data = str(justif.etat)
|
||||
|
||||
@ -968,7 +968,7 @@ def choix_date() -> str:
|
||||
ok: bool = False
|
||||
try:
|
||||
date: datetime.date = datetime.datetime.strptime(
|
||||
form.date.data, "%d/%m/%Y"
|
||||
form.date.data, scu.DATE_FMT
|
||||
).date()
|
||||
if date < formsemestre.date_debut or date > formsemestre.date_fin:
|
||||
form.set_error(
|
||||
@ -999,8 +999,8 @@ def choix_date() -> str:
|
||||
"assiduites/pages/choix_date.j2",
|
||||
form=form,
|
||||
sco=ScoData(formsemestre=formsemestre),
|
||||
deb=formsemestre.date_debut.strftime("%d/%m/%Y"),
|
||||
fin=formsemestre.date_fin.strftime("%d/%m/%Y"),
|
||||
deb=formsemestre.date_debut.strftime(scu.DATE_FMT),
|
||||
fin=formsemestre.date_fin.strftime(scu.DATE_FMT),
|
||||
)
|
||||
|
||||
|
||||
@ -1607,11 +1607,11 @@ def recup_assiduites_plage():
|
||||
|
||||
# Vérification des dates
|
||||
try:
|
||||
date_deb = datetime.datetime.strptime(date_deb, "%d/%m/%Y")
|
||||
date_deb = datetime.datetime.strptime(date_deb, scu.DATE_FMT)
|
||||
except ValueError as exc:
|
||||
raise ScoValueError("date_debut invalide", dest_url=request.referrer) from exc
|
||||
try:
|
||||
date_fin = datetime.datetime.strptime(date_fin, "%d/%m/%Y")
|
||||
date_fin = datetime.datetime.strptime(date_fin, scu.DATE_FMT)
|
||||
except ValueError as exc:
|
||||
raise ScoValueError("date_fin invalide", dest_url=request.referrer) from exc
|
||||
|
||||
@ -1893,12 +1893,12 @@ def _preparer_objet(
|
||||
"filenames": filenames,
|
||||
}
|
||||
|
||||
objet_prepare["date_fin"] = objet.date_fin.strftime("%d/%m/%y à %H:%M")
|
||||
objet_prepare["date_fin"] = objet.date_fin.strftime(scu.DATEATIME_FMT)
|
||||
objet_prepare["real_date_fin"] = objet.date_fin.isoformat()
|
||||
objet_prepare["date_debut"] = objet.date_debut.strftime("%d/%m/%y à %H:%M")
|
||||
objet_prepare["date_debut"] = objet.date_debut.strftime(scu.DATEATIME_FMT)
|
||||
objet_prepare["real_date_debut"] = objet.date_debut.isoformat()
|
||||
|
||||
objet_prepare["entry_date"] = objet.entry_date.strftime("%d/%m/%y à %H:%M")
|
||||
objet_prepare["entry_date"] = objet.entry_date.strftime(scu.DATEATIME_FMT)
|
||||
|
||||
objet_prepare["etud_nom"] = objet.etudiant.nomprenom
|
||||
|
||||
@ -2243,7 +2243,7 @@ def _get_date_str(deb: datetime.datetime, fin: datetime.datetime) -> str:
|
||||
"du dd/mm/yyyy hh:MM audd/mm/yyyy hh:MM" sinon
|
||||
"""
|
||||
if deb.date() == fin.date():
|
||||
temps = deb.strftime("%d/%m/%Y %H:%M").split(" ") + [fin.strftime("%H:%M")]
|
||||
temps = deb.strftime("%d/%m/%Y %H:%M").split(" ") + [fin.strftime(scu.TIME_FMT)]
|
||||
return f"le {temps[0]} de {temps[1]} à {temps[2]}"
|
||||
return f'du {deb.strftime("%d/%m/%Y %H:%M")} au {fin.strftime("%d/%m/%Y %H:%M")}'
|
||||
|
||||
@ -2542,7 +2542,7 @@ class Jour:
|
||||
"""
|
||||
Renvoie la date du jour au format "dd/mm/yyyy"
|
||||
"""
|
||||
return self.date.strftime("%d/%m/%Y")
|
||||
return self.date.strftime(scu.DATE_FMT)
|
||||
|
||||
def get_class(self, show_pres: bool = False, show_reta: bool = False) -> str:
|
||||
"""
|
||||
|
@ -2455,7 +2455,7 @@ def formsemestre_validation_but(
|
||||
if formsemestre.date_fin - datetime.date.today() > datetime.timedelta(days=12):
|
||||
# encore loin de la fin du semestre de départ de ce jury ?
|
||||
warning += f"""<div class="warning">Le semestre S{formsemestre.semestre_id}
|
||||
terminera le {formsemestre.date_fin.strftime("%d/%m/%Y")} :
|
||||
terminera le {formsemestre.date_fin.strftime(scu.DATE_FMT)} :
|
||||
êtes-vous certain de vouloir enregistrer une décision de jury ?
|
||||
</div>"""
|
||||
|
||||
|
@ -1162,7 +1162,7 @@ def _form_dem_of_def(
|
||||
).first_or_404()
|
||||
if not formsemestre.etat:
|
||||
raise ScoValueError("Modification impossible: semestre verrouille")
|
||||
nowdmy = time.strftime("%d/%m/%Y")
|
||||
nowdmy = time.strftime(scu.DATE_FMT)
|
||||
#
|
||||
header = html_sco_header.sco_header(
|
||||
page_title=f"""{operation_name} de {etud.nomprenom} (du semestre {formsemestre.titre_mois()})"""
|
||||
|
@ -245,7 +245,7 @@ def create_user_form(user_name=None, edit=0, all_roles=True):
|
||||
initvalues["roles"] = []
|
||||
if "date_expiration" in initvalues:
|
||||
initvalues["date_expiration"] = (
|
||||
the_user.date_expiration.strftime("%d/%m/%Y")
|
||||
the_user.date_expiration.strftime(scu.DATE_FMT)
|
||||
if the_user.date_expiration
|
||||
else ""
|
||||
)
|
||||
@ -391,9 +391,9 @@ def create_user_form(user_name=None, edit=0, all_roles=True):
|
||||
{
|
||||
"title": "e-mail",
|
||||
"input_type": "text",
|
||||
"explanation": "requis, doit fonctionner"
|
||||
if not edit_only_roles
|
||||
else "",
|
||||
"explanation": (
|
||||
"requis, doit fonctionner" if not edit_only_roles else ""
|
||||
),
|
||||
"size": 36,
|
||||
"allow_null": False,
|
||||
"readonly": edit_only_roles,
|
||||
@ -448,10 +448,10 @@ def create_user_form(user_name=None, edit=0, all_roles=True):
|
||||
"title": "e-mail institutionnel",
|
||||
"input_type": "text",
|
||||
"explanation": (
|
||||
"requis" if require_email_institutionnel else "facultatif"
|
||||
)
|
||||
("requis" if require_email_institutionnel else "facultatif")
|
||||
if not edit_only_roles
|
||||
else "",
|
||||
else ""
|
||||
),
|
||||
"size": 36,
|
||||
"allow_null": not require_email_institutionnel,
|
||||
"readonly": edit_only_roles,
|
||||
@ -550,9 +550,11 @@ def create_user_form(user_name=None, edit=0, all_roles=True):
|
||||
{
|
||||
"title": "Date d'expiration", # j/m/a
|
||||
"input_type": "datedmy",
|
||||
"explanation": "j/m/a, laisser vide si pas de limite"
|
||||
"explanation": (
|
||||
"j/m/a, laisser vide si pas de limite"
|
||||
if not edit_only_roles
|
||||
else "",
|
||||
else ""
|
||||
),
|
||||
"size": 9,
|
||||
"allow_null": True,
|
||||
"readonly": edit_only_roles,
|
||||
@ -664,7 +666,7 @@ def create_user_form(user_name=None, edit=0, all_roles=True):
|
||||
try:
|
||||
if vals["date_expiration"]:
|
||||
vals["date_expiration"] = datetime.datetime.strptime(
|
||||
vals["date_expiration"], "%d/%m/%Y"
|
||||
vals["date_expiration"], scu.DATE_FMT
|
||||
)
|
||||
if vals["date_expiration"] < datetime.datetime.now():
|
||||
H.append(tf_error_message("date expiration passée"))
|
||||
|
@ -414,7 +414,7 @@ class ScoFake(object):
|
||||
for e_idx in range(1, nb_evaluations_per_module + 1):
|
||||
e = self.create_evaluation(
|
||||
moduleimpl_id=moduleimpl_id,
|
||||
date_debut=datetime.datetime.strptime(date_debut, "%d/%m/%Y"),
|
||||
date_debut=datetime.datetime.strptime(date_debut, scu.DATE_FMT),
|
||||
description="evaluation test %s" % e_idx,
|
||||
coefficient=1.0,
|
||||
)
|
||||
|
@ -962,8 +962,8 @@ def _create_abs(
|
||||
date_debut, date_fin, demijournee, estjust=False, etudid=False, estabs=True
|
||||
):
|
||||
etud = Identite.from_request(etudid)
|
||||
deb: dt.date = dt.datetime.strptime(date_debut, "%d/%m/%Y").date()
|
||||
fin: dt.date = dt.datetime.strptime(date_fin, "%d/%m/%Y").date()
|
||||
deb: dt.date = dt.datetime.strptime(date_debut, scu.DATE_FMT).date()
|
||||
fin: dt.date = dt.datetime.strptime(date_fin, scu.DATE_FMT).date()
|
||||
abs_list: list[Absence] = []
|
||||
while deb < fin:
|
||||
if deb.weekday() in [5, 6]:
|
||||
|
Loading…
Reference in New Issue
Block a user