1
0
forked from ScoDoc/ScoDoc
This commit is contained in:
Emmanuel Viennet 2023-12-15 05:30:11 +01:00
parent f85039fb55
commit 96c98bc3fc

View File

@ -4,6 +4,8 @@ Ecrit par Matthias Hartmann.
from datetime import date, datetime, time, timedelta
from pytz import UTC
from flask_sqlalchemy.query import Query
from app import log, db
import app.scodoc.sco_utils as scu
from app.models.assiduites import Assiduite, Justificatif, compute_assiduites_justified
@ -13,7 +15,6 @@ from app.scodoc import sco_formsemestre_inscriptions
from app.scodoc import sco_preferences
from app.scodoc import sco_cache
from app.scodoc import sco_etud
from flask_sqlalchemy.query import Query
class CountCalculator:
@ -412,6 +413,7 @@ def create_absence(
description: str = None,
est_just: bool = False,
) -> int:
"""TODO: doc, dire quand l'utiliser"""
etud: Identite = Identite.query.filter_by(etudid=etudid).first_or_404()
assiduite_unique: Assiduite = Assiduite.create_assiduite(
etud=etud,
@ -552,7 +554,7 @@ def invalidate_assiduites_count_sem(sem: dict):
invalidate_assiduites_count(ins["etudid"], sem)
def invalidate_assiduites_etud_date(etudid, date: datetime):
def invalidate_assiduites_etud_date(etudid: int, the_date: datetime):
"""Doit etre appelé à chaque modification des assiduites
pour cet étudiant et cette date.
Invalide cache absence et caches semestre
@ -569,9 +571,9 @@ def invalidate_assiduites_etud_date(etudid, date: datetime):
sem
for sem in etud["sems"]
if scu.is_iso_formated(sem["date_debut_iso"], True).replace(tzinfo=UTC)
<= date.replace(tzinfo=UTC)
<= the_date.replace(tzinfo=UTC)
and scu.is_iso_formated(sem["date_fin_iso"], True).replace(tzinfo=UTC)
>= date.replace(tzinfo=UTC)
>= the_date.replace(tzinfo=UTC)
]
# Invalide les PDF et les absences: