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 # See LICENSE
############################################################################## ##############################################################################
import numpy as np
"""Quelques classes auxiliaires pour les calculs des notes """Quelques classes auxiliaires pour les calculs des notes
""" """
import numpy as np
class StatsMoyenne: class StatsMoyenne:
"""Une moyenne d'un ensemble étudiants sur quelque chose """Une moyenne d'un ensemble étudiants sur quelque chose

View File

@ -137,6 +137,9 @@ class NotesTableCompat(ResultatsSemestre):
} }
self.moy_min = "NA" self.moy_min = "NA"
self.moy_max = "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]: def get_etudids(self, sorted=False) -> list[int]:
"""Liste des etudids inscrits, incluant les démissionnaires. """Liste des etudids inscrits, incluant les démissionnaires.

View File

@ -4,7 +4,7 @@
# See LICENSE # See LICENSE
############################################################################## ##############################################################################
"""Chargement des résultats de semestres (tous types)) """Chargement des résultats de semestres (tous types)
""" """
from flask import g from flask import g
@ -25,10 +25,14 @@ def load_formsemestre_result(formsemestre: FormSemestre) -> ResultatsSemestre:
""" """
# --- Try local cache (within the same request context) # --- Try local cache (within the same request context)
if not hasattr(g, "formsemestre_result_cache"): if not hasattr(g, "formsemestre_result_cache"):
g.formsemestre_result_cache = {} g.formsemestre_result_cache = {} # pylint: disable=C0237
else: else:
if formsemestre.id in g.formsemestre_result_cache: if formsemestre.id in g.formsemestre_result_cache:
return g.formsemestre_result_cache[formsemestre.id] 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) return klass(formsemestre)

View File

@ -170,7 +170,6 @@ class NotesTable:
""" """
def __init__(self, formsemestre_id): def __init__(self, formsemestre_id):
# XXX breakpoint()
log(f"NotesTable( formsemestre_id={formsemestre_id} )") log(f"NotesTable( formsemestre_id={formsemestre_id} )")
if not formsemestre_id: if not formsemestre_id:
raise ValueError("invalid formsemestre_id (%s)" % formsemestre_id) raise ValueError("invalid formsemestre_id (%s)" % formsemestre_id)

View File

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

View File

@ -35,7 +35,9 @@ from flask import url_for
from flask_login import current_user from flask_login import current_user
from app import log from app import log
from app.comp import res_sem
from app.models import Module from app.models import Module
from app.models import formsemestre
from app.models.formsemestre import FormSemestre from app.models.formsemestre import FormSemestre
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc.sco_utils import ModuleType from app.scodoc.sco_utils import ModuleType
@ -990,6 +992,9 @@ def formsemestre_status(formsemestre_id=None):
formsemestre_id=formsemestre_id formsemestre_id=formsemestre_id
) )
nt = sco_cache.NotesTableCache.get(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: # Construit la liste de tous les enseignants de ce semestre:
mails_enseignants = set( mails_enseignants = set(
[sco_users.user_info(ens_id)["email"] for ens_id in sem["responsables"]] [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 import log
from app.but import bulletin_but 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 import FormSemestre
from app.models.etudiants import Identite from app.models.etudiants import Identite
@ -307,12 +307,12 @@ def make_formsemestre_recapcomplet(
# nt = sco_cache.NotesTableCache.get(formsemestre_id) # nt = sco_cache.NotesTableCache.get(formsemestre_id)
# XXX EXPERIMENTAL # XXX EXPERIMENTAL
nt = ResultatsSemestreClassic(formsemestre) nt = res_sem.load_formsemestre_result(formsemestre)
modimpls = nt.get_modimpls_dict() modimpls = nt.get_modimpls_dict()
ues = nt.get_ues_stat_dict() # incluant le(s) UE de sport ues = nt.get_ues_stat_dict() # incluant le(s) UE de sport
# #
if formsemestre.formation.is_apc(): # if formsemestre.formation.is_apc():
nt.apc_recompute_moyennes() # nt.apc_recompute_moyennes()
# #
partitions, partitions_etud_groups = sco_groups.get_formsemestre_groups( partitions, partitions_etud_groups = sco_groups.get_formsemestre_groups(
formsemestre_id formsemestre_id