Calcul sans notes table: table recap ok.

This commit is contained in:
Emmanuel Viennet 2022-01-08 18:06:00 +01:00
parent 4c325b70de
commit 795ca343de
7 changed files with 21 additions and 11 deletions

View File

@ -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

View File

@ -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.

View File

@ -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)

View File

@ -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)

View File

@ -317,7 +317,6 @@ class DefferedSemCacheManager:
# ---- Nouvelles classes ScoDoc 9.2
@classmethod
class ResultatsSemestreCache(ScoDocCache):
"""Cache pour les résultats ResultatsSemestre.
Clé: formsemestre_id

View File

@ -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"]]

View File

@ -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