forked from ScoDoc/DocScoDoc
Elimination des derniers NotesTableCache
This commit is contained in:
parent
129a39f7f0
commit
67fc12053e
@ -4,7 +4,7 @@
|
||||
# See LICENSE
|
||||
##############################################################################
|
||||
|
||||
from collections import defaultdict, Counter
|
||||
from collections import Counter
|
||||
from functools import cached_property
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
@ -367,7 +367,7 @@ class NotesTableCompat(ResultatsSemestre):
|
||||
sous forme de dict etud,
|
||||
classée dans l'ordre alphabétique de noms.
|
||||
"""
|
||||
etuds = self.formsemestre.get_inscrits(include_demdef=True, sorted=True)
|
||||
etuds = self.formsemestre.get_inscrits(include_demdef=True, order=True)
|
||||
return [e.to_dict_scodoc7() for e in etuds]
|
||||
|
||||
@cached_property
|
||||
@ -401,7 +401,7 @@ class NotesTableCompat(ResultatsSemestre):
|
||||
d = modimpl.to_dict()
|
||||
# compat ScoDoc < 9.2: ajoute matières
|
||||
d["mat"] = modimpl.module.matiere.to_dict()
|
||||
modimpls_dict.append(d)
|
||||
modimpls_dict.append(d)
|
||||
return modimpls_dict
|
||||
|
||||
def compute_rangs(self):
|
||||
|
@ -121,6 +121,7 @@ class FormSemestre(db.Model):
|
||||
d.pop("_sa_instance_state", None)
|
||||
# ScoDoc7 output_formators: (backward compat)
|
||||
d["formsemestre_id"] = self.id
|
||||
d["titre_num"] = self.titre_num()
|
||||
if self.date_debut:
|
||||
d["date_debut"] = self.date_debut.strftime("%d/%m/%Y")
|
||||
d["date_debut_iso"] = self.date_debut.isoformat()
|
||||
|
@ -322,12 +322,10 @@ class JuryPE(object):
|
||||
etudiants = []
|
||||
for sem in semsListe: # pour chacun des semestres de la liste
|
||||
|
||||
# nt = self.get_notes_d_un_semestre( sem['formsemestre_id'] )
|
||||
nt = self.get_cache_notes_d_un_semestre(sem["formsemestre_id"])
|
||||
# sco_cache.NotesTableCache.get( sem['formsemestre_id'])
|
||||
etudiantsDuSemestre = (
|
||||
nt.get_etudids()
|
||||
) # nt.identdict.keys() # identification des etudiants du semestre
|
||||
) # identification des etudiants du semestre
|
||||
|
||||
if pe_tools.PE_DEBUG:
|
||||
pe_tools.pe_print(
|
||||
|
@ -171,7 +171,7 @@ class NotesTable:
|
||||
|
||||
def __init__(self, formsemestre_id):
|
||||
# log(f"NotesTable( formsemestre_id={formsemestre_id} )")
|
||||
# raise NotImplementedError() # XXX
|
||||
raise NotImplementedError() # XXX
|
||||
if not formsemestre_id:
|
||||
raise ValueError("invalid formsemestre_id (%s)" % formsemestre_id)
|
||||
self.formsemestre_id = formsemestre_id
|
||||
|
@ -33,7 +33,9 @@ import datetime
|
||||
from flask import url_for, g, request, abort
|
||||
|
||||
from app import log
|
||||
from app.models import Identite
|
||||
from app.comp import res_sem
|
||||
from app.comp.res_common import NotesTableCompat
|
||||
from app.models import Identite, FormSemestre
|
||||
import app.scodoc.sco_utils as scu
|
||||
from app.scodoc import notesdb as ndb
|
||||
from app.scodoc.scolog import logdb
|
||||
@ -118,7 +120,8 @@ def doSignaleAbsence(
|
||||
if moduleimpl_id and moduleimpl_id != "NULL":
|
||||
mod = sco_moduleimpl.moduleimpl_list(moduleimpl_id=moduleimpl_id)[0]
|
||||
formsemestre_id = mod["formsemestre_id"]
|
||||
nt = sco_cache.NotesTableCache.get(formsemestre_id)
|
||||
formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
ues = nt.get_ues_stat_dict()
|
||||
for ue in ues:
|
||||
modimpls = nt.get_modimpls_dict(ue_id=ue["ue_id"])
|
||||
@ -179,11 +182,12 @@ def SignaleAbsenceEtud(): # etudid implied
|
||||
menu_module = ""
|
||||
else:
|
||||
formsemestre_id = etud["cursem"]["formsemestre_id"]
|
||||
formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
ues = nt.get_ues_stat_dict()
|
||||
require_module = sco_preferences.get_preference(
|
||||
"abs_require_module", formsemestre_id
|
||||
)
|
||||
nt = sco_cache.NotesTableCache.get(formsemestre_id)
|
||||
ues = nt.get_ues_stat_dict()
|
||||
if require_module:
|
||||
menu_module = """
|
||||
<script type="text/javascript">
|
||||
|
@ -95,9 +95,12 @@ from flask import send_file
|
||||
# Pour la détection auto de l'encodage des fichiers Apogée:
|
||||
from chardet import detect as chardet_detect
|
||||
|
||||
from app import log
|
||||
from app.comp import res_sem
|
||||
from app.comp.res_common import NotesTableCompat
|
||||
from app.models import FormSemestre
|
||||
from app.models.config import ScoDocSiteConfig
|
||||
import app.scodoc.sco_utils as scu
|
||||
from app import log
|
||||
from app.scodoc.sco_exceptions import ScoValueError, ScoFormatError
|
||||
from app.scodoc.gen_tables import GenTable
|
||||
from app.scodoc.sco_vdi import ApoEtapeVDI
|
||||
@ -370,7 +373,9 @@ class ApoEtud(dict):
|
||||
dict: with N, B, J, R keys, ou None si elt non trouvé
|
||||
"""
|
||||
etudid = self.etud["etudid"]
|
||||
nt = sco_cache.NotesTableCache.get(sem["formsemestre_id"])
|
||||
formsemestre = FormSemestre.query.get_or_404(sem["formsemestre_id"])
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
|
||||
if etudid not in nt.identdict:
|
||||
return None # etudiant non inscrit dans ce semestre
|
||||
|
||||
@ -476,7 +481,8 @@ class ApoEtud(dict):
|
||||
# l'étudiant n'a pas de semestre courant ?!
|
||||
log("comp_elt_annuel: etudid %s has no cur_sem" % etudid)
|
||||
return VOID_APO_RES
|
||||
cur_nt = sco_cache.NotesTableCache.get(cur_sem["formsemestre_id"])
|
||||
cur_formsemestre = FormSemestre.query.get_or_404(cur_sem["formsemestre_id"])
|
||||
cur_nt: NotesTableCompat = res_sem.load_formsemestre_results(cur_formsemestre)
|
||||
cur_decision = cur_nt.get_etud_decision_sem(etudid)
|
||||
if not cur_decision:
|
||||
# pas de decision => pas de résultat annuel
|
||||
@ -493,7 +499,10 @@ class ApoEtud(dict):
|
||||
|
||||
decision_apo = ScoDocSiteConfig.get_code_apo(cur_decision["code"])
|
||||
|
||||
autre_nt = sco_cache.NotesTableCache.get(autre_sem["formsemestre_id"])
|
||||
autre_formsemestre = FormSemestre.query.get_or_404(autre_sem["formsemestre_id"])
|
||||
autre_nt: NotesTableCompat = res_sem.load_formsemestre_results(
|
||||
autre_formsemestre
|
||||
)
|
||||
autre_decision = autre_nt.get_etud_decision_sem(etudid)
|
||||
if not autre_decision:
|
||||
# pas de decision dans l'autre => pas de résultat annuel
|
||||
@ -554,7 +563,8 @@ class ApoEtud(dict):
|
||||
# prend le plus recent avec decision
|
||||
cur_sem = None
|
||||
for sem in cur_sems:
|
||||
nt = sco_cache.NotesTableCache.get(sem["formsemestre_id"])
|
||||
formsemestre = FormSemestre.query.get_or_404(sem["formsemestre_id"])
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
decision = nt.get_etud_decision_sem(self.etud["etudid"])
|
||||
if decision:
|
||||
cur_sem = sem
|
||||
@ -614,7 +624,8 @@ class ApoEtud(dict):
|
||||
else:
|
||||
autre_sem = None
|
||||
for sem in autres_sems:
|
||||
nt = sco_cache.NotesTableCache.get(sem["formsemestre_id"])
|
||||
formsemestre = FormSemestre.query.get_or_404(sem["formsemestre_id"])
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
decision = nt.get_etud_decision_sem(self.etud["etudid"])
|
||||
if decision:
|
||||
autre_sem = sem
|
||||
@ -947,7 +958,8 @@ class ApoData(object):
|
||||
s.add(code)
|
||||
continue
|
||||
# associé à une UE:
|
||||
nt = sco_cache.NotesTableCache.get(sem["formsemestre_id"])
|
||||
formsemestre = FormSemestre.query.get_or_404(sem["formsemestre_id"])
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
for ue in nt.get_ues_stat_dict():
|
||||
if ue["code_apogee"] and code in ue["code_apogee"].split(","):
|
||||
s.add(code)
|
||||
|
@ -140,7 +140,6 @@ def formsemestre_bulletinetud_dict(formsemestre_id, etudid, version="long"):
|
||||
raise ValueError("invalid version code !")
|
||||
|
||||
prefs = sco_preferences.SemPreferences(formsemestre_id)
|
||||
# nt = sco_cache.NotesTableCache.get(formsemestre_id) # > toutes notes
|
||||
formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
if not nt.get_etud_etat(etudid):
|
||||
@ -363,10 +362,7 @@ def formsemestre_bulletinetud_dict(formsemestre_id, etudid, version="long"):
|
||||
>{u["ue_descr_txt"]} pouet</a>
|
||||
"""
|
||||
if ue_status["moy"] != "NA" and ue_status["formsemestre_id"]:
|
||||
# detail des modules de l'UE capitalisee
|
||||
# nt_cap = sco_cache.NotesTableCache.get(
|
||||
# ue_status["formsemestre_id"]
|
||||
# ) # > toutes notes
|
||||
# détail des modules de l'UE capitalisée
|
||||
formsemestre_cap = FormSemestre.query.get_or_404(
|
||||
ue_status["formsemestre_id"]
|
||||
)
|
||||
|
@ -31,15 +31,17 @@ Rapport (table) avec dernier semestre fréquenté et débouché de chaque étudi
|
||||
import http
|
||||
from flask import url_for, g, request
|
||||
|
||||
from app import log
|
||||
from app.comp import res_sem
|
||||
from app.comp.res_common import NotesTableCompat
|
||||
from app.models import FormSemestre
|
||||
import app.scodoc.sco_utils as scu
|
||||
import app.scodoc.notesdb as ndb
|
||||
from app import log
|
||||
from app.scodoc.sco_exceptions import AccessDenied
|
||||
from app.scodoc.scolog import logdb
|
||||
from app.scodoc.gen_tables import GenTable
|
||||
from app.scodoc import safehtml
|
||||
from app.scodoc import html_sco_header
|
||||
from app.scodoc import sco_cache
|
||||
from app.scodoc import sco_permissions_check
|
||||
from app.scodoc import sco_preferences
|
||||
from app.scodoc import sco_tag_module
|
||||
@ -115,7 +117,7 @@ def get_etudids_with_debouche(start_year):
|
||||
|
||||
|
||||
def table_debouche_etudids(etudids, keep_numeric=True):
|
||||
"""Rapport pour ces etudiants"""
|
||||
"""Rapport pour ces étudiants"""
|
||||
L = []
|
||||
for etudid in etudids:
|
||||
etud = sco_etud.get_etud_info(filled=True, etudid=etudid)[0]
|
||||
@ -124,7 +126,8 @@ def table_debouche_etudids(etudids, keep_numeric=True):
|
||||
es = [(s["date_fin_iso"], i) for i, s in enumerate(sems)]
|
||||
imax = max(es)[1]
|
||||
last_sem = sems[imax]
|
||||
nt = sco_cache.NotesTableCache.get(last_sem["formsemestre_id"])
|
||||
formsemestre = FormSemestre.query.get_or_404(last_sem["formsemestre_id"])
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
row = {
|
||||
"etudid": etudid,
|
||||
"civilite": etud["civilite"],
|
||||
|
@ -384,8 +384,8 @@ print apo_csv_list_stored_archives()
|
||||
|
||||
groups_infos = sco_groups_view.DisplayedGroupsInfos( [sco_groups.get_default_group(formsemestre_id)], formsemestre_id=formsemestre_id)
|
||||
|
||||
nt = sco_cache.NotesTableCache.get( formsemestre_id)
|
||||
|
||||
formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
#
|
||||
s = SemSet('NSS29902')
|
||||
apo_data = sco_apogee_csv.ApoData(open('/opt/scodoc/var/scodoc/archives/apo_csv/RT/2015-2/2016-07-10-11-26-15/V1RT.csv').read(), periode=1)
|
||||
|
@ -403,8 +403,9 @@ def do_evaluation_etat_in_mod(nt, moduleimpl_id):
|
||||
|
||||
def formsemestre_evaluations_cal(formsemestre_id):
|
||||
"""Page avec calendrier de toutes les evaluations de ce semestre"""
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
nt = sco_cache.NotesTableCache.get(formsemestre_id) # > liste evaluations
|
||||
formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
sem = formsemestre.to_dict()
|
||||
|
||||
evals = nt.get_evaluations_etats()
|
||||
nb_evals = len(evals)
|
||||
@ -538,8 +539,9 @@ def formsemestre_evaluations_delai_correction(formsemestre_id, format="html"):
|
||||
|
||||
N'indique pas les évaluations de ratrapage ni celles des modules de bonus/malus.
|
||||
"""
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
nt = sco_cache.NotesTableCache.get(formsemestre_id) # > liste evaluations
|
||||
formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
sem = formsemestre.to_dict()
|
||||
|
||||
evals = nt.get_evaluations_etats()
|
||||
T = []
|
||||
|
@ -29,6 +29,9 @@
|
||||
"""
|
||||
from flask import url_for, g, request
|
||||
|
||||
from app.comp import res_sem
|
||||
from app.comp.res_common import NotesTableCompat
|
||||
from app.models import FormSemestre
|
||||
import app.scodoc.notesdb as ndb
|
||||
import app.scodoc.sco_utils as scu
|
||||
from app import log
|
||||
@ -77,7 +80,8 @@ def _build_results_table(start_date=None, end_date=None, types_parcours=[]):
|
||||
{}
|
||||
) # etudid : { formsemestre_id d'inscription le plus recent dans les dates considérées, etud }
|
||||
for formsemestre_id in formsemestre_ids_parcours:
|
||||
nt = sco_cache.NotesTableCache.get(formsemestre_id) # > get_etudids
|
||||
formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
etudids = nt.get_etudids()
|
||||
for etudid in etudids:
|
||||
if etudid not in etuds_infos: # pas encore traité ?
|
||||
|
@ -37,6 +37,9 @@ import flask
|
||||
from flask import url_for, g, request
|
||||
from flask_login import current_user
|
||||
|
||||
from app.comp import res_sem
|
||||
from app.comp.res_common import NotesTableCompat
|
||||
from app.models import FormSemestre
|
||||
import app.scodoc.sco_utils as scu
|
||||
import app.scodoc.notesdb as ndb
|
||||
from app import log
|
||||
@ -260,7 +263,8 @@ def formsemestre_ext_edit_ue_validations(formsemestre_id, etudid):
|
||||
|
||||
|
||||
def _make_page(etud, sem, tf, message=""):
|
||||
nt = sco_cache.NotesTableCache.get(sem["formsemestre_id"])
|
||||
formsemestre = FormSemestre.query.get_or_404(sem["formsemestre_id"])
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
moy_gen = nt.get_etud_moy_gen(etud["etudid"])
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
|
@ -36,8 +36,8 @@ from flask_login import current_user
|
||||
|
||||
from app import log
|
||||
from app.comp import res_sem
|
||||
from app.comp.res_common import NotesTableCompat
|
||||
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
|
||||
@ -51,7 +51,6 @@ from app.scodoc import sco_archives
|
||||
from app.scodoc import sco_bulletins
|
||||
from app.scodoc import sco_codes_parcours
|
||||
from app.scodoc import sco_compute_moy
|
||||
from app.scodoc import sco_cache
|
||||
from app.scodoc import sco_edit_ue
|
||||
from app.scodoc import sco_evaluations
|
||||
from app.scodoc import sco_evaluation_db
|
||||
@ -597,7 +596,8 @@ def formsemestre_description_table(formsemestre_id, with_evals=False):
|
||||
Liste des modules et de leurs coefficients
|
||||
"""
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
nt = sco_cache.NotesTableCache.get(formsemestre_id) # > liste evaluations
|
||||
formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
use_ue_coefs = sco_preferences.get_preference("use_ue_coefs", formsemestre_id)
|
||||
F = sco_formations.formation_list(args={"formation_id": sem["formation_id"]})[0]
|
||||
parcours = sco_codes_parcours.get_parcours_from_code(F["type_parcours"])
|
||||
@ -991,7 +991,6 @@ def formsemestre_status(formsemestre_id=None):
|
||||
modimpls = sco_moduleimpl.moduleimpl_withmodule_list(
|
||||
formsemestre_id=formsemestre_id
|
||||
)
|
||||
# nt = sco_cache.NotesTableCache.get(formsemestre_id)
|
||||
formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
||||
nt = res_sem.load_formsemestre_results(formsemestre)
|
||||
|
||||
|
@ -31,16 +31,17 @@
|
||||
import flask
|
||||
from flask import url_for, g, request
|
||||
|
||||
from app import models
|
||||
from app.models.evaluations import Evaluation
|
||||
from app.models.moduleimpls import ModuleImpl
|
||||
import app.scodoc.sco_utils as scu
|
||||
import app.scodoc.notesdb as ndb
|
||||
from app import log
|
||||
from app import models
|
||||
from app.comp import res_sem
|
||||
from app.comp import moy_mod
|
||||
from app.comp.moy_mod import ModuleImplResults
|
||||
from app.comp.res_common import NotesTableCompat
|
||||
from app.models import FormSemestre
|
||||
from app.models.evaluations import Evaluation
|
||||
from app.models.moduleimpls import ModuleImpl
|
||||
import app.scodoc.sco_utils as scu
|
||||
import app.scodoc.notesdb as ndb
|
||||
from app.scodoc.TrivialFormulator import TrivialFormulator
|
||||
from app.scodoc import sco_cache
|
||||
from app.scodoc import sco_edit_module
|
||||
@ -788,7 +789,9 @@ def _add_moymod_column(
|
||||
):
|
||||
"""Ajoute la colonne moymod à rows"""
|
||||
col_id = "moymod"
|
||||
nt = sco_cache.NotesTableCache.get(formsemestre_id) # > get_etud_mod_moy
|
||||
formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
|
||||
nb_notes = 0
|
||||
sum_notes = 0
|
||||
notes = [] # liste des notes numeriques, pour calcul histogramme uniquement
|
||||
|
@ -203,7 +203,6 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
||||
moduleimpl_id=M["moduleimpl_id"]
|
||||
)
|
||||
|
||||
# nt = sco_cache.NotesTableCache.get(formsemestre_id)
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(modimpl.formsemestre)
|
||||
|
||||
mod_evals = sco_evaluation_db.do_evaluation_list({"moduleimpl_id": moduleimpl_id})
|
||||
|
@ -299,9 +299,6 @@ class SituationEtudParcoursGeneric(object):
|
||||
sem["semestre_id"] == n1
|
||||
and sem["formation_code"] == self.formation.formation_code
|
||||
):
|
||||
# nt = sco_cache.NotesTableCache.get(
|
||||
# sem["formsemestre_id"]
|
||||
# ) # > get_etud_decision_sem
|
||||
formsemestre = FormSemestre.query.get_or_404(sem["formsemestre_id"])
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(
|
||||
formsemestre
|
||||
@ -409,9 +406,6 @@ class SituationEtudParcoursGeneric(object):
|
||||
if not sem:
|
||||
code = "" # non inscrit à ce semestre
|
||||
else:
|
||||
# nt = sco_cache.NotesTableCache.get(
|
||||
# sem["formsemestre_id"]
|
||||
# ) # > get_etud_decision_sem
|
||||
formsemestre = FormSemestre.query.get_or_404(sem["formsemestre_id"])
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
decision = nt.get_etud_decision_sem(self.etudid)
|
||||
@ -481,7 +475,6 @@ class SituationEtudParcoursGeneric(object):
|
||||
# Verifications basiques:
|
||||
# ?
|
||||
# Code etat du semestre precedent:
|
||||
# nt = sco_cache.NotesTableCache.get(prev["formsemestre_id"])
|
||||
formsemestre = FormSemestre.query.get_or_404(prev["formsemestre_id"])
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
self.prev_decision = nt.get_etud_decision_sem(self.etudid)
|
||||
@ -540,8 +533,6 @@ class SituationEtudParcoursGeneric(object):
|
||||
sem["formation_code"] == self.formation.formation_code
|
||||
and sem["semestre_id"] == s
|
||||
):
|
||||
# nt = sco_cache.NotesTableCache.get(sem["formsemestre_id"])
|
||||
# > get_etud_decision_sem
|
||||
formsemestre = FormSemestre.query.get_or_404(sem["formsemestre_id"])
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(
|
||||
formsemestre
|
||||
|
@ -33,6 +33,9 @@ import collections
|
||||
|
||||
from flask import url_for, g, request
|
||||
|
||||
from app.comp import res_sem
|
||||
from app.comp.res_common import NotesTableCompat
|
||||
from app.models import FormSemestre
|
||||
import app.scodoc.sco_utils as scu
|
||||
from app.scodoc import sco_abs
|
||||
from app.scodoc import sco_cache
|
||||
@ -58,7 +61,8 @@ def etud_get_poursuite_info(sem, etud):
|
||||
for s in etud["sems"]:
|
||||
if s["semestre_id"] == sem_id:
|
||||
etudid = etud["etudid"]
|
||||
nt = sco_cache.NotesTableCache.get(s["formsemestre_id"])
|
||||
formsemestre = FormSemestre.query.get_or_404(s["formsemestre_id"])
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
dec = nt.get_etud_decision_sem(etudid)
|
||||
# Moyennes et rangs des UE
|
||||
ues = nt.get_ues_stat_dict(filter_sport=True)
|
||||
|
@ -217,9 +217,6 @@ def dict_pvjury(
|
||||
'decisions_dict' : { etudid : decision (comme ci-dessus) },
|
||||
}
|
||||
"""
|
||||
# nt = sco_cache.NotesTableCache.get(
|
||||
# formsemestre_id
|
||||
# ) # > get_etudids, get_etud_etat, get_etud_decision_sem, get_etud_decision_ues
|
||||
formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
if etudids is None:
|
||||
|
@ -29,15 +29,16 @@
|
||||
|
||||
Formulaire revu en juillet 2016
|
||||
"""
|
||||
import sys
|
||||
import time
|
||||
import datetime
|
||||
import psycopg2
|
||||
|
||||
import flask
|
||||
from flask import g, url_for, request
|
||||
from flask_login import current_user
|
||||
|
||||
from app.comp import res_sem
|
||||
from app.comp.res_common import NotesTableCompat
|
||||
from app.models import FormSemestre
|
||||
import app.scodoc.sco_utils as scu
|
||||
from app.scodoc.sco_utils import ModuleType
|
||||
import app.scodoc.notesdb as ndb
|
||||
@ -49,7 +50,6 @@ from app.scodoc.sco_exceptions import (
|
||||
ScoGenError,
|
||||
ScoValueError,
|
||||
)
|
||||
from app.scodoc.sco_permissions import Permission
|
||||
from app.scodoc.TrivialFormulator import TrivialFormulator, TF
|
||||
from app.scodoc import html_sco_header, sco_users
|
||||
from app.scodoc import htmlutils
|
||||
@ -872,9 +872,8 @@ def has_existing_decision(M, E, etudid):
|
||||
Si oui, return True
|
||||
"""
|
||||
formsemestre_id = M["formsemestre_id"]
|
||||
nt = sco_cache.NotesTableCache.get(
|
||||
formsemestre_id
|
||||
) # > get_etud_decision_sem, get_etud_decision_ues
|
||||
formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
if nt.get_etud_decision_sem(etudid):
|
||||
return True
|
||||
dec_ues = nt.get_etud_decision_ues(etudid)
|
||||
|
@ -42,6 +42,9 @@ sem_set_list()
|
||||
import flask
|
||||
from flask import g
|
||||
|
||||
from app.comp import res_sem
|
||||
from app.comp.res_common import NotesTableCompat
|
||||
from app.models import FormSemestre
|
||||
from app.scodoc import html_sco_header
|
||||
from app.scodoc import sco_cache
|
||||
from app.scodoc import sco_etape_apogee
|
||||
@ -239,7 +242,8 @@ class SemSet(dict):
|
||||
self["etuds_without_nip"] = set() # etudids
|
||||
self["jury_ok"] = True
|
||||
for sem in self.sems:
|
||||
nt = sco_cache.NotesTableCache.get(sem["formsemestre_id"])
|
||||
formsemestre = FormSemestre.query.get_or_404(sem["formsemestre_id"])
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
sem["etuds"] = list(nt.identdict.values())
|
||||
sem["nips"] = {e["code_nip"] for e in sem["etuds"] if e["code_nip"]}
|
||||
sem["etuds_without_nip"] = {
|
||||
|
@ -37,6 +37,9 @@ import http
|
||||
|
||||
from flask import g, url_for
|
||||
|
||||
from app.comp import res_sem
|
||||
from app.comp.res_common import NotesTableCompat
|
||||
from app.models import FormSemestre
|
||||
import app.scodoc.sco_utils as scu
|
||||
import app.scodoc.notesdb as ndb
|
||||
from app import log
|
||||
@ -269,7 +272,8 @@ def get_etud_tagged_modules(etudid, tagname):
|
||||
etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0]
|
||||
R = []
|
||||
for sem in etud["sems"]:
|
||||
nt = sco_cache.NotesTableCache.get(sem["formsemestre_id"])
|
||||
formsemestre = FormSemestre.query.get_or_404(sem["formsemestre_id"])
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
modimpls = nt.get_modimpls_dict()
|
||||
for modimpl in modimpls:
|
||||
tags = module_tag_list(module_id=modimpl["module_id"])
|
||||
|
@ -60,22 +60,22 @@ from flask import g, request
|
||||
from flask import url_for
|
||||
from flask_login import current_user
|
||||
|
||||
from app import log
|
||||
from app.comp import res_sem
|
||||
from app.comp.res_common import NotesTableCompat
|
||||
from app.decorators import (
|
||||
scodoc,
|
||||
scodoc7func,
|
||||
permission_required,
|
||||
admin_required,
|
||||
login_required,
|
||||
permission_required_compat_scodoc7,
|
||||
)
|
||||
|
||||
from app.models import FormSemestre
|
||||
from app.models.absences import BilletAbsence
|
||||
from app.views import absences_bp as bp
|
||||
|
||||
# ---------------
|
||||
from app.models.absences import BilletAbsence
|
||||
from app.scodoc import sco_utils as scu
|
||||
from app.scodoc import notesdb as ndb
|
||||
from app import log
|
||||
from app.scodoc.scolog import logdb
|
||||
from app.scodoc.sco_permissions import Permission
|
||||
from app.scodoc.sco_exceptions import ScoValueError, APIInvalidParams
|
||||
@ -83,15 +83,10 @@ from app.scodoc.TrivialFormulator import TrivialFormulator
|
||||
from app.scodoc.gen_tables import GenTable
|
||||
from app.scodoc import html_sco_header
|
||||
from app.scodoc import sco_abs
|
||||
from app.scodoc import sco_abs_notification
|
||||
from app.scodoc import sco_abs_views
|
||||
from app.scodoc import sco_cache
|
||||
from app.scodoc import sco_compute_moy
|
||||
from app.scodoc import sco_etud
|
||||
from app.scodoc import sco_excel
|
||||
from app.scodoc import sco_find_etud
|
||||
from app.scodoc import sco_formsemestre
|
||||
from app.scodoc import sco_groups
|
||||
from app.scodoc import sco_groups_view
|
||||
from app.scodoc import sco_moduleimpl
|
||||
from app.scodoc import sco_preferences
|
||||
@ -372,8 +367,12 @@ def SignaleAbsenceGrHebdo(
|
||||
else:
|
||||
# Si aucun etudiant n'est inscrit au module choisi...
|
||||
moduleimpl_id = None
|
||||
nt = sco_cache.NotesTableCache.get(formsemestre_id)
|
||||
sem = sco_formsemestre.do_formsemestre_list({"formsemestre_id": formsemestre_id})[0]
|
||||
|
||||
formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
|
||||
sem = formsemestre.to_dict()
|
||||
# sem = sco_formsemestre.do_formsemestre_list({"formsemestre_id": formsemestre_id})[0]
|
||||
|
||||
# calcule dates jours de cette semaine
|
||||
# liste de dates iso "yyyy-mm-dd"
|
||||
@ -493,10 +492,11 @@ def SignaleAbsenceGrSemestre(
|
||||
+ html_sco_header.sco_footer()
|
||||
)
|
||||
formsemestre_id = groups_infos.formsemestre_id
|
||||
formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
||||
sem = formsemestre.to_dict()
|
||||
require_module = sco_preferences.get_preference(
|
||||
"abs_require_module", formsemestre_id
|
||||
)
|
||||
sem = sco_formsemestre.do_formsemestre_list({"formsemestre_id": formsemestre_id})[0]
|
||||
etuds = [
|
||||
sco_etud.get_etud_info(etudid=m["etudid"], filled=True)[0]
|
||||
for m in groups_infos.members
|
||||
@ -526,7 +526,7 @@ def SignaleAbsenceGrSemestre(
|
||||
base_url = base_url_noweeks + "&nbweeks=%s" % nbweeks # sans le moduleimpl_id
|
||||
|
||||
if etuds:
|
||||
nt = sco_cache.NotesTableCache.get(formsemestre_id)
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
|
||||
work_saturday = sco_abs.is_work_saturday()
|
||||
jourdebut = sco_abs.ddmmyyyy(datedebut, work_saturday=work_saturday)
|
||||
@ -729,7 +729,10 @@ def _gen_form_saisie_groupe(
|
||||
# UE capitalisee dans semestre courant ?
|
||||
cap = []
|
||||
if etud["cursem"]:
|
||||
nt = sco_cache.NotesTableCache.get(etud["cursem"]["formsemestre_id"])
|
||||
formsemestre = FormSemestre.query.get_or_404(
|
||||
etud["cursem"]["formsemestre_id"]
|
||||
)
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
for ue in nt.get_ues_stat_dict():
|
||||
ue_status = nt.get_etud_ue_status(etudid, ue["ue_id"])
|
||||
if ue_status and ue_status["is_capitalized"]:
|
||||
|
@ -39,6 +39,9 @@ from flask import flash, jsonify, render_template, url_for
|
||||
from flask import current_app, g, request
|
||||
from flask_login import current_user
|
||||
from werkzeug.utils import redirect
|
||||
|
||||
from app.comp import res_sem
|
||||
from app.comp.res_common import NotesTableCompat
|
||||
from app.models.formsemestre import FormSemestre
|
||||
from app.models.formsemestre import FormSemestreUEComputationExpr
|
||||
from app.models.ues import UniteEns
|
||||
@ -1427,13 +1430,14 @@ def formsemestre_desinscription(etudid, formsemestre_id, dialog_confirmed=False)
|
||||
S'il s'agit d'un semestre extérieur et qu'il n'y a plus d'inscrit,
|
||||
le semestre sera supprimé.
|
||||
"""
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
||||
sem = formsemestre.to_dict() # compat
|
||||
# -- check lock
|
||||
if not sem["etat"]:
|
||||
if not formsemestre.etat:
|
||||
raise ScoValueError("desinscription impossible: semestre verrouille")
|
||||
|
||||
# -- Si décisions de jury, désinscription interdite
|
||||
nt = sco_cache.NotesTableCache.get(formsemestre_id)
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
if nt.etud_has_decision(etudid):
|
||||
raise ScoValueError(
|
||||
"""Désinscription impossible: l'étudiant a une décision de jury
|
||||
@ -1446,7 +1450,7 @@ def formsemestre_desinscription(etudid, formsemestre_id, dialog_confirmed=False)
|
||||
)
|
||||
if not dialog_confirmed:
|
||||
etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0]
|
||||
if sem["modalite"] != "EXT":
|
||||
if formsemestre.modalite != "EXT":
|
||||
msg_ext = """
|
||||
<p>%s sera désinscrit de tous les modules du semestre %s (%s - %s).</p>
|
||||
<p>Cette opération ne doit être utilisée que pour corriger une <b>erreur</b> !
|
||||
@ -1898,7 +1902,8 @@ def formsemestre_bulletins_mailetuds(
|
||||
):
|
||||
"envoi a chaque etudiant (inscrit et ayant un mail) son bulletin"
|
||||
prefer_mail_perso = int(prefer_mail_perso)
|
||||
nt = sco_cache.NotesTableCache.get(formsemestre_id) # > get_etudids
|
||||
formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
etudids = nt.get_etudids()
|
||||
#
|
||||
if not sco_bulletins.can_send_bulletin_by_mail(formsemestre_id):
|
||||
@ -2247,9 +2252,10 @@ def formsemestre_validation_suppress_etud(
|
||||
dest_url=scu.ScoURL(),
|
||||
)
|
||||
if not dialog_confirmed:
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0]
|
||||
nt = sco_cache.NotesTableCache.get(formsemestre_id) # > get_etud_decision_sem
|
||||
formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
||||
sem = formsemestre.to_dict()
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
decision_jury = nt.get_etud_decision_sem(etudid)
|
||||
if decision_jury:
|
||||
existing = (
|
||||
|
@ -13,6 +13,9 @@ from flask import current_app, g
|
||||
|
||||
import app
|
||||
from app import db
|
||||
from app.comp import res_sem
|
||||
from app.comp.res_common import NotesTableCompat
|
||||
from app.models import FormSemestre
|
||||
from app.scodoc import sco_cache
|
||||
from app.scodoc import sco_evaluations
|
||||
from app.scodoc import sco_evaluation_db
|
||||
@ -24,7 +27,7 @@ from tests.unit.test_sco_basic import run_sco_basic
|
||||
DEPT = TestConfig.DEPT_TEST
|
||||
|
||||
|
||||
def test_notes_table(test_client):
|
||||
def test_notes_table(test_client): # XXX A REVOIR POUR TESTER RES TODO
|
||||
"""Test construction et cache de NotesTable."""
|
||||
app.set_sco_dept(DEPT)
|
||||
assert g.scodoc_dept == DEPT
|
||||
@ -35,7 +38,8 @@ def test_notes_table(test_client):
|
||||
assert len(sems)
|
||||
sem = sems[0]
|
||||
formsemestre_id = sem["formsemestre_id"]
|
||||
nt = sco_cache.NotesTableCache.get(formsemestre_id)
|
||||
formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
assert nt
|
||||
assert sco_cache.NotesTableCache.get(formsemestre_id, compute=False)
|
||||
sco_cache.invalidate_formsemestre(formsemestre_id)
|
||||
|
@ -10,6 +10,9 @@ from tests.unit import sco_fake_gen
|
||||
from flask import g
|
||||
|
||||
import app
|
||||
from app.comp import res_sem
|
||||
from app.comp.res_common import NotesTableCompat
|
||||
from app.models import FormSemestre
|
||||
from app.scodoc import sco_bulletins, sco_formsemestre
|
||||
from app.scodoc import sco_cache
|
||||
from app.scodoc import sco_formsemestre_inscriptions
|
||||
@ -33,7 +36,8 @@ def check_nt(
|
||||
(peut changer dans le futur, ne pas utiliser hors ScoDoc !)
|
||||
ne vérifie que les valeurs expected non False
|
||||
"""
|
||||
nt = sco_cache.NotesTableCache.get(formsemestre_id)
|
||||
formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
mod_moy = nt.get_etud_mod_moy(moduleimpl_id, etudid)
|
||||
if expected_moy_ue is not False:
|
||||
ue_status = nt.get_etud_ue_status(etudid, ue_id)
|
||||
@ -262,7 +266,8 @@ def test_notes_modules(test_client):
|
||||
formsemestre_id=formsemestre_id,
|
||||
)
|
||||
_, _, _ = G.create_note(evaluation=e1, etud=etud, note=12.5)
|
||||
nt = sco_cache.NotesTableCache.get(formsemestre_id)
|
||||
formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
ue_status = nt.get_etud_ue_status(etudid, ue_id)
|
||||
assert ue_status["nb_missing"] == 1 # 1 même si etud non inscrit à l'autre module
|
||||
assert ue_status["nb_notes"] == 1
|
||||
@ -276,7 +281,8 @@ def test_notes_modules(test_client):
|
||||
{"etudid": etuds[1]["etudid"], "moduleimpl_id": moduleimpl_id2},
|
||||
formsemestre_id=formsemestre_id,
|
||||
)
|
||||
nt = sco_cache.NotesTableCache.get(formsemestre_id)
|
||||
formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
ue_status = nt.get_etud_ue_status(etudid, ue_id)
|
||||
assert ue_status["nb_missing"] == 1 # mi2 n'a pas encore de note
|
||||
assert ue_status["nb_notes"] == 1
|
||||
@ -288,7 +294,8 @@ def test_notes_modules(test_client):
|
||||
coefficient=1.0,
|
||||
)
|
||||
_, _, _ = G.create_note(evaluation=e_m2, etud=etud, note=19.5)
|
||||
nt = sco_cache.NotesTableCache.get(formsemestre_id)
|
||||
formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
ue_status = nt.get_etud_ue_status(etudid, ue_id)
|
||||
assert ue_status["nb_missing"] == 1 # manque une note
|
||||
assert ue_status["nb_notes"] == 1
|
||||
|
@ -19,7 +19,10 @@ from config import TestConfig
|
||||
from tests.unit import sco_fake_gen
|
||||
|
||||
import app
|
||||
from app.scodoc import notesdb as ndb, sco_formsemestre
|
||||
from app.comp import res_sem
|
||||
from app.comp.res_common import NotesTableCompat
|
||||
from app.models import FormSemestre
|
||||
from app.scodoc import sco_formsemestre
|
||||
from app.scodoc import sco_abs
|
||||
from app.scodoc import sco_abs_views
|
||||
from app.scodoc import sco_bulletins
|
||||
@ -208,7 +211,8 @@ def run_sco_basic(verbose=False):
|
||||
redirect=False,
|
||||
)
|
||||
# Vérifie que toutes les UE des étudiants notés ont été acquises:
|
||||
nt = sco_cache.NotesTableCache.get(formsemestre_id)
|
||||
formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
for etud in etuds[:5]:
|
||||
dec_ues = nt.get_etud_decision_ues(etud["etudid"])
|
||||
for ue_id in dec_ues:
|
||||
|
Loading…
Reference in New Issue
Block a user