Fix: cache inval. apres saisie jutif indiv.

This commit is contained in:
Emmanuel Viennet 2023-12-15 01:31:15 +01:00
parent 2e6ac8e60a
commit 515cbaf406
4 changed files with 7 additions and 6 deletions

View File

@ -532,7 +532,7 @@ def get_assiduites_count_in_interval(
return r
def invalidate_assiduites_count(etudid, sem):
def invalidate_assiduites_count(etudid: int, sem: dict):
"""Invalidate (clear) cached counts"""
date_debut = sem["date_debut_iso"]
date_fin = sem["date_fin_iso"]
@ -541,7 +541,7 @@ def invalidate_assiduites_count(etudid, sem):
sco_cache.AbsSemEtudCache.delete(key)
def invalidate_assiduites_count_sem(sem):
def invalidate_assiduites_count_sem(sem: dict):
"""Invalidate (clear) cached abs counts for all the students of this semestre"""
inscriptions = (
sco_formsemestre_inscriptions.do_formsemestre_inscription_listinscrits(

View File

@ -29,7 +29,7 @@ class TableAssi(tb.Table):
**kwargs,
):
self.rows: list["RowEtud"] = [] # juste pour que VSCode nous aide sur .rows
classes = ["gt_table", "gt_left"]
classes = ["gt_table"]
self.dates = [str(dates[0]) + "T00:00", str(dates[1]) + "T23:59"]
self.formsemestre = formsemestre
super().__init__(

View File

@ -34,7 +34,7 @@
function stats() {
const deb = Date.fromFRA(document.querySelector('#stats_date_debut').value);
const fin = Date.fromFRA(document.querySelector('#stats_date_fin').value);
location.href = `VisualisationAssiduitesGroupe?group_ids=${group_ids}&date_debut=${deb}&date_fin=${fin}`;
location.href = `visu_assi_group?group_ids=${group_ids}&date_debut=${deb}&date_fin=${fin}`;
}
window.addEventListener('load', () => {

View File

@ -692,6 +692,7 @@ def _record_justificatif_etud(
return False
db.session.commit()
compute_assiduites_justified(etud.id, [just])
scass.simple_invalidate_cache(just.to_dict(), etud.id)
flash("Justificatif enregistré")
return True
except ScoValueError as exc:
@ -1209,7 +1210,7 @@ def etat_abs_date():
)
@bp.route("/VisualisationAssiduitesGroupe")
@bp.route("/visu_assi_group")
@scodoc
@permission_required(Permission.ScoView)
def visu_assi_group():
@ -1263,7 +1264,7 @@ def visu_assi_group():
# Génération de la page
return render_template(
"assiduites/pages/visu_assi.j2",
"assiduites/pages/visu_assi_group.j2",
assi_metric=scu.translate_assiduites_metric(
scu.translate_assiduites_metric(
sco_preferences.get_preference(