diff --git a/app/scodoc/sco_cache.py b/app/scodoc/sco_cache.py index 19f3dd63b..d65482a1c 100644 --- a/app/scodoc/sco_cache.py +++ b/app/scodoc/sco_cache.py @@ -80,7 +80,7 @@ class ScoDocCache: @classmethod def get(cls, oid): - """Returns cached evaluation, or None""" + """Returns cached object, or None""" try: return CACHE.get(cls._get_key(oid)) except: @@ -129,7 +129,7 @@ class EvaluationCache(ScoDocCache): "delete evaluations in this formsemestre from cache" req = """SELECT e.id FROM notes_formsemestre s, notes_evaluation e, notes_moduleimpl m - WHERE s.id = %(formsemestre_id)s and s.id=m.id and e.moduleimpl_id=m.id; + WHERE s.id = %(formsemestre_id)s and s.id=m.formsemestre_id and e.moduleimpl_id=m.id; """ evaluation_ids = [ x[0] for x in ndb.SimpleQuery(req, {"formsemestre_id": formsemestre_id}) diff --git a/tests/unit/test_caches.py b/tests/unit/test_caches.py index 7b6f0542f..37392feec 100644 --- a/tests/unit/test_caches.py +++ b/tests/unit/test_caches.py @@ -17,7 +17,7 @@ from app.scodoc import sco_evaluations from app.scodoc import sco_formsemestre from app.scodoc import notesdb as ndb from config import TestConfig - +from tests.unit.test_sco_basic import run_sco_basic DEPT = TestConfig.DEPT_TEST context = None # #context @@ -28,7 +28,7 @@ def test_notes_table(test_client): ndb.set_sco_dept(DEPT) assert g.scodoc_dept == DEPT # prépare le département avec quelques semestres: - run_scenario1() + run_sco_basic() # sems = sco_formsemestre.do_formsemestre_list(context) assert len(sems) @@ -50,6 +50,9 @@ def test_cache_evaluations(test_client): """""" # cherche un semestre ayant des evaluations ndb.set_sco_dept(DEPT) + # prépare le département avec quelques semestres: + run_sco_basic() + # sems = sco_formsemestre.do_formsemestre_list(None) assert len(sems) sem_evals = []