From 795ca343de5a91cef1d872c1b9ee4030d0ec3918 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sat, 8 Jan 2022 18:06:00 +0100 Subject: [PATCH] Calcul sans notes table: table recap ok. --- app/comp/aux.py | 4 ++-- app/comp/res_common.py | 3 +++ app/comp/res_sem.py | 10 +++++++--- app/scodoc/notes_table.py | 1 - app/scodoc/sco_cache.py | 1 - app/scodoc/sco_formsemestre_status.py | 5 +++++ app/scodoc/sco_recapcomplet.py | 8 ++++---- 7 files changed, 21 insertions(+), 11 deletions(-) diff --git a/app/comp/aux.py b/app/comp/aux.py index 92ee22c1b..6a758a64b 100644 --- a/app/comp/aux.py +++ b/app/comp/aux.py @@ -4,11 +4,11 @@ # See LICENSE ############################################################################## -import numpy as np - """Quelques classes auxiliaires pour les calculs des notes """ +import numpy as np + class StatsMoyenne: """Une moyenne d'un ensemble étudiants sur quelque chose diff --git a/app/comp/res_common.py b/app/comp/res_common.py index cb9290b4e..73d003696 100644 --- a/app/comp/res_common.py +++ b/app/comp/res_common.py @@ -137,6 +137,9 @@ class NotesTableCompat(ResultatsSemestre): } self.moy_min = "NA" self.moy_max = "NA" + self.moy_moy = "NA" + self.expr_diagnostics = "" + self.parcours = self.formsemestre.formation.get_parcours() def get_etudids(self, sorted=False) -> list[int]: """Liste des etudids inscrits, incluant les démissionnaires. diff --git a/app/comp/res_sem.py b/app/comp/res_sem.py index 44f140a33..8e14d5afe 100644 --- a/app/comp/res_sem.py +++ b/app/comp/res_sem.py @@ -4,7 +4,7 @@ # See LICENSE ############################################################################## -"""Chargement des résultats de semestres (tous types)) +"""Chargement des résultats de semestres (tous types) """ from flask import g @@ -25,10 +25,14 @@ def load_formsemestre_result(formsemestre: FormSemestre) -> ResultatsSemestre: """ # --- Try local cache (within the same request context) if not hasattr(g, "formsemestre_result_cache"): - g.formsemestre_result_cache = {} + g.formsemestre_result_cache = {} # pylint: disable=C0237 else: if formsemestre.id in g.formsemestre_result_cache: return g.formsemestre_result_cache[formsemestre.id] - klass = ResultatsSemestreBUT if formsemestre.is_apc() else ResultatsSemestreClassic + klass = ( + ResultatsSemestreBUT + if formsemestre.formation.is_apc() + else ResultatsSemestreClassic + ) return klass(formsemestre) diff --git a/app/scodoc/notes_table.py b/app/scodoc/notes_table.py index 0e21efb24..828ea228c 100644 --- a/app/scodoc/notes_table.py +++ b/app/scodoc/notes_table.py @@ -170,7 +170,6 @@ class NotesTable: """ def __init__(self, formsemestre_id): - # XXX breakpoint() log(f"NotesTable( formsemestre_id={formsemestre_id} )") if not formsemestre_id: raise ValueError("invalid formsemestre_id (%s)" % formsemestre_id) diff --git a/app/scodoc/sco_cache.py b/app/scodoc/sco_cache.py index fb43fbf3c..17ddd09b6 100644 --- a/app/scodoc/sco_cache.py +++ b/app/scodoc/sco_cache.py @@ -317,7 +317,6 @@ class DefferedSemCacheManager: # ---- Nouvelles classes ScoDoc 9.2 -@classmethod class ResultatsSemestreCache(ScoDocCache): """Cache pour les résultats ResultatsSemestre. Clé: formsemestre_id diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index 303cb2000..d0ee4b1a7 100644 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -35,7 +35,9 @@ from flask import url_for from flask_login import current_user from app import log +from app.comp import res_sem from app.models import Module +from app.models import formsemestre from app.models.formsemestre import FormSemestre import app.scodoc.sco_utils as scu from app.scodoc.sco_utils import ModuleType @@ -990,6 +992,9 @@ def formsemestre_status(formsemestre_id=None): formsemestre_id=formsemestre_id ) nt = sco_cache.NotesTableCache.get(formsemestre_id) + # WIP formsemestre = FormSemestre.query.get_or_404(formsemestre_id) + # WIP nt = res_sem.load_formsemestre_result(formsemestre) + # Construit la liste de tous les enseignants de ce semestre: mails_enseignants = set( [sco_users.user_info(ens_id)["email"] for ens_id in sem["responsables"]] diff --git a/app/scodoc/sco_recapcomplet.py b/app/scodoc/sco_recapcomplet.py index 293dd2084..714f5eaa3 100644 --- a/app/scodoc/sco_recapcomplet.py +++ b/app/scodoc/sco_recapcomplet.py @@ -37,7 +37,7 @@ from flask import make_response from app import log from app.but import bulletin_but -from app.comp.res_classic import ResultatsSemestreClassic +from app.comp import res_sem from app.models import FormSemestre from app.models.etudiants import Identite @@ -307,12 +307,12 @@ def make_formsemestre_recapcomplet( # nt = sco_cache.NotesTableCache.get(formsemestre_id) # XXX EXPERIMENTAL - nt = ResultatsSemestreClassic(formsemestre) + nt = res_sem.load_formsemestre_result(formsemestre) modimpls = nt.get_modimpls_dict() ues = nt.get_ues_stat_dict() # incluant le(s) UE de sport # - if formsemestre.formation.is_apc(): - nt.apc_recompute_moyennes() + # if formsemestre.formation.is_apc(): + # nt.apc_recompute_moyennes() # partitions, partitions_etud_groups = sco_groups.get_formsemestre_groups( formsemestre_id