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