From da1a2ccf43e8076a1b131b601a3ce15b086a3665 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 7 Jan 2022 15:08:45 +0100 Subject: [PATCH] =?UTF-8?q?suite=20r=C3=A9organisation=20calculs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/comp/res_but.py | 2 +- app/comp/res_classic.py | 2 +- app/comp/{res_sem.py => res_common.py} | 0 app/scodoc/sco_cache.py | 26 +++++++++++++++----------- 4 files changed, 17 insertions(+), 13 deletions(-) rename app/comp/{res_sem.py => res_common.py} (100%) diff --git a/app/comp/res_but.py b/app/comp/res_but.py index cc0b88079..aa9f3fe05 100644 --- a/app/comp/res_but.py +++ b/app/comp/res_but.py @@ -8,7 +8,7 @@ """ from app.comp import moy_ue, moy_sem, inscr_mod -from app.comp.res_sem import NotesTableCompat +from app.comp.res_common import NotesTableCompat class ResultatsSemestreBUT(NotesTableCompat): diff --git a/app/comp/res_classic.py b/app/comp/res_classic.py index 6cf092a81..93e3a9fb0 100644 --- a/app/comp/res_classic.py +++ b/app/comp/res_classic.py @@ -9,7 +9,7 @@ import numpy as np import pandas as pd from app.comp import moy_mod, moy_ue, moy_sem, inscr_mod -from app.comp.res_sem import NotesTableCompat +from app.comp.res_common import NotesTableCompat from app.models.formsemestre import FormSemestre diff --git a/app/comp/res_sem.py b/app/comp/res_common.py similarity index 100% rename from app/comp/res_sem.py rename to app/comp/res_common.py diff --git a/app/scodoc/sco_cache.py b/app/scodoc/sco_cache.py index 5bc9d3de8..fb43fbf3c 100644 --- a/app/scodoc/sco_cache.py +++ b/app/scodoc/sco_cache.py @@ -155,16 +155,6 @@ class EvaluationCache(ScoDocCache): cls.delete_many(evaluation_ids) -class ResultatsSemestreCache(ScoDocCache): - """Cache pour les résultats ResultatsSemestre. - Clé: formsemestre_id - Valeur: { un paquet de dataframes } - """ - - prefix = "RSEM" - timeout = 60 * 60 # ttl 1 heure (en phase de mise au point) - - class AbsSemEtudCache(ScoDocCache): """Cache pour les comptes d'absences d'un étudiant dans un semestre. Ce cache étant indépendant des semestres, le compte peut être faux lorsqu'on @@ -224,7 +214,9 @@ class NotesTableCache(ScoDocCache): def get(cls, formsemestre_id, compute=True): """Returns NotesTable for this formsemestre Search in local cache (g.nt_cache) or global app cache (eg REDIS) - If not in cache and compute is True, build it and cache it. + If not in cache: + If compute is True, build it and cache it + Else return None """ # try local cache (same request) if not hasattr(g, "nt_cache"): @@ -322,3 +314,15 @@ class DefferedSemCacheManager: while g.sem_to_invalidate: formsemestre_id = g.sem_to_invalidate.pop() invalidate_formsemestre(formsemestre_id) + + +# ---- Nouvelles classes ScoDoc 9.2 +@classmethod +class ResultatsSemestreCache(ScoDocCache): + """Cache pour les résultats ResultatsSemestre. + Clé: formsemestre_id + Valeur: { un paquet de dataframes } + """ + + prefix = "RSEM" + timeout = 60 * 60 # ttl 1 heure (en phase de mise au point)