From 60f5bdfc60786e4a3d8061a430a7d62ed152ddaf Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 11 Jul 2022 18:28:58 +0200 Subject: [PATCH] =?UTF-8?q?Validations=20auto=20classic=20et=20BUT:=20acc?= =?UTF-8?q?=C3=A9l=C3=A9ration=20via=20DeferredSemCacheManager.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/but/jury_but_validation_auto.py | 18 ++-- app/scodoc/sco_formsemestre_validation.py | 101 +++++++++++----------- 2 files changed, 60 insertions(+), 59 deletions(-) diff --git a/app/but/jury_but_validation_auto.py b/app/but/jury_but_validation_auto.py index 99512168..5c54c7b3 100644 --- a/app/but/jury_but_validation_auto.py +++ b/app/but/jury_but_validation_auto.py @@ -4,15 +4,14 @@ # See LICENSE ############################################################################## -"""Jury BUT: clacul des décisions de jury annuelles "automatiques" +"""Jury BUT: calcul des décisions de jury annuelles "automatiques" """ -from flask import g, url_for - from app import db from app.but import jury_but from app.models.etudiants import Identite from app.models.formsemestre import FormSemestre +from app.scodoc import sco_cache from app.scodoc.sco_exceptions import ScoValueError @@ -23,12 +22,13 @@ def formsemestre_validation_auto_but(formsemestre: FormSemestre) -> int: if not formsemestre.formation.is_apc(): raise ScoValueError("fonction réservée aux formations BUT") nb_admis = 0 - for etudid in formsemestre.etuds_inscriptions: - etud: Identite = Identite.query.get(etudid) - deca = jury_but.DecisionsProposeesAnnee(etud, formsemestre) - if deca.admis: # année réussie - deca.record_all() - nb_admis += 1 + with sco_cache.DeferredSemCacheManager(): + for etudid in formsemestre.etuds_inscriptions: + etud: Identite = Identite.query.get(etudid) + deca = jury_but.DecisionsProposeesAnnee(etud, formsemestre) + if deca.admis: # année réussie + deca.record_all() + nb_admis += 1 db.session.commit() return nb_admis diff --git a/app/scodoc/sco_formsemestre_validation.py b/app/scodoc/sco_formsemestre_validation.py index 2effc138..cd1fc359 100644 --- a/app/scodoc/sco_formsemestre_validation.py +++ b/app/scodoc/sco_formsemestre_validation.py @@ -871,10 +871,9 @@ def form_decision_manuelle(Se, formsemestre_id, etudid, desturl="", sortcol=None # ----------- def formsemestre_validation_auto(formsemestre_id): "Formulaire saisie automatisee des decisions d'un semestre" - sem = sco_formsemestre.get_formsemestre(formsemestre_id) H = [ html_sco_header.html_sem_header("Saisie automatique des décisions du semestre"), - """ + f"""