forked from ScoDoc/ScoDoc
Jury BUT: invalidation cache semestre
This commit is contained in:
parent
2bfbaa3a2a
commit
a1f772b22e
@ -89,6 +89,7 @@ from app.models.formations import Formation
|
||||
from app.models.formsemestre import FormSemestre, FormSemestreInscription
|
||||
from app.models.ues import UniteEns
|
||||
from app.models.validations import ScolarFormSemestreValidation
|
||||
from app.scodoc import sco_cache
|
||||
from app.scodoc import sco_codes_parcours as sco_codes
|
||||
from app.scodoc.sco_codes_parcours import RED, UE_STANDARD
|
||||
from app.scodoc import sco_utils as scu
|
||||
@ -573,6 +574,8 @@ class DecisionsProposeesAnnee(DecisionsProposees):
|
||||
Si les code_rcue et le code_annee ne sont pas fournis,
|
||||
et qu'il n'y en a pas déjà, enregistre ceux par défaut.
|
||||
"""
|
||||
log("jury_but.DecisionsProposeesAnnee.record_form")
|
||||
with sco_cache.DeferredSemCacheManager():
|
||||
for key in form:
|
||||
code = form[key]
|
||||
# Codes d'UE
|
||||
@ -647,6 +650,16 @@ class DecisionsProposeesAnnee(DecisionsProposees):
|
||||
)
|
||||
|
||||
self.recorded = True
|
||||
self.invalidate_formsemestre_cache()
|
||||
|
||||
def invalidate_formsemestre_cache(self):
|
||||
"invalide le résultats des deux formsemestres"
|
||||
if self.formsemestre_impair is not None:
|
||||
sco_cache.invalidate_formsemestre(
|
||||
formsemestre_id=self.formsemestre_impair.id
|
||||
)
|
||||
if self.formsemestre_pair is not None:
|
||||
sco_cache.invalidate_formsemestre(formsemestre_id=self.formsemestre_pair.id)
|
||||
|
||||
def record_all(self):
|
||||
"""Enregistre les codes qui n'ont pas été spécifiés par le formulaire, et sont donc en mode "automatique" """
|
||||
@ -687,6 +700,7 @@ class DecisionsProposeesAnnee(DecisionsProposees):
|
||||
for validation in validations:
|
||||
db.session.delete(validation)
|
||||
db.session.flush()
|
||||
self.invalidate_formsemestre_cache()
|
||||
|
||||
def get_autorisations_passage(self) -> list[int]:
|
||||
"""Les liste des indices de semestres auxquels on est autorisé à
|
||||
@ -805,6 +819,14 @@ class DecisionsProposeesRCUE(DecisionsProposees):
|
||||
msg=f"Validation RCUE {repr(self.rcue)}",
|
||||
)
|
||||
db.session.add(self.validation)
|
||||
if self.rcue.formsemestre_1 is not None:
|
||||
sco_cache.invalidate_formsemestre(
|
||||
formsemestre_id=self.rcue.formsemestre_1.id
|
||||
)
|
||||
if self.rcue.formsemestre_2 is not None:
|
||||
sco_cache.invalidate_formsemestre(
|
||||
formsemestre_id=self.rcue.formsemestre_2.id
|
||||
)
|
||||
self.recorded = True
|
||||
|
||||
def erase(self):
|
||||
@ -948,6 +970,8 @@ class DecisionsProposeesUE(DecisionsProposees):
|
||||
msg=f"Validation UE {self.ue.id}",
|
||||
)
|
||||
db.session.add(self.validation)
|
||||
|
||||
sco_cache.invalidate_formsemestre(formsemestre_id=self.formsemestre.id)
|
||||
self.recorded = True
|
||||
|
||||
def erase(self):
|
||||
|
Loading…
Reference in New Issue
Block a user