forked from ScoDoc/ScoDoc
Update opolka/ScoDoc from ScoDoc/ScoDoc #2
@ -297,7 +297,7 @@ class Identite(models.ScoDocModel):
|
||||
else:
|
||||
return self.nom
|
||||
|
||||
@cached_property
|
||||
@property
|
||||
def nomprenom(self, reverse=False) -> str:
|
||||
"""Civilité/nom/prenom pour affichages: "M. Pierre Dupont"
|
||||
Si reverse, "Dupont Pierre", sans civilité.
|
||||
|
@ -945,7 +945,7 @@ class FormSemestre(models.ScoDocModel):
|
||||
ins.etudid for ins in self.inscriptions if ins.etat == scu.INSCRIT
|
||||
}
|
||||
|
||||
@cached_property
|
||||
@property
|
||||
def etuds_inscriptions(self) -> dict:
|
||||
"""Map { etudid : inscription } (incluant DEM et DEF)"""
|
||||
return {ins.etud.id: ins for ins in self.inscriptions}
|
||||
|
@ -55,7 +55,6 @@ from flask import g
|
||||
|
||||
import app
|
||||
from app import db, log
|
||||
from app.scodoc import notesdb as ndb
|
||||
from app.scodoc import sco_utils as scu
|
||||
from app.scodoc.sco_exceptions import ScoException
|
||||
|
||||
@ -174,17 +173,15 @@ class EvaluationCache(ScoDocCache):
|
||||
@classmethod
|
||||
def invalidate_all_sems(cls):
|
||||
"delete all evaluations in current dept from cache"
|
||||
from app.models.evaluations import Evaluation
|
||||
from app.models.formsemestre import FormSemestre
|
||||
from app.models.moduleimpls import ModuleImpl
|
||||
|
||||
evaluation_ids = [
|
||||
x[0]
|
||||
for x in ndb.SimpleQuery(
|
||||
"""SELECT e.id
|
||||
FROM notes_evaluation e, notes_moduleimpl mi, notes_formsemestre s
|
||||
WHERE s.dept_id=%(dept_id)s
|
||||
AND s.id = mi.formsemestre_id
|
||||
AND mi.id = e.moduleimpl_id;
|
||||
""",
|
||||
{"dept_id": g.scodoc_dept_id},
|
||||
)
|
||||
e.id
|
||||
for e in Evaluation.query.join(ModuleImpl)
|
||||
.join(FormSemestre)
|
||||
.filter_by(dept_id=g.scodoc_dept_id)
|
||||
]
|
||||
cls.delete_many(evaluation_ids)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user