2021-12-24 00:08:25 +01:00
|
|
|
##############################################################################
|
|
|
|
# ScoDoc
|
2023-01-02 13:16:27 +01:00
|
|
|
# Copyright (c) 1999 - 2023 Emmanuel Viennet. All rights reserved.
|
2021-12-24 00:08:25 +01:00
|
|
|
# See LICENSE
|
|
|
|
##############################################################################
|
|
|
|
|
2022-04-02 13:30:26 +02:00
|
|
|
"""Résultats semestre: méthodes communes aux formations classiques et APC
|
|
|
|
"""
|
|
|
|
|
2022-02-13 23:53:11 +01:00
|
|
|
from collections import Counter
|
2022-07-18 17:48:10 +02:00
|
|
|
from collections.abc import Generator
|
2021-12-24 00:08:25 +01:00
|
|
|
from functools import cached_property
|
|
|
|
import numpy as np
|
|
|
|
import pandas as pd
|
2022-02-07 16:32:04 +01:00
|
|
|
|
2022-03-27 22:25:00 +02:00
|
|
|
from flask import g, url_for
|
2022-02-27 20:12:20 +01:00
|
|
|
|
2022-04-05 22:23:55 +02:00
|
|
|
from app.auth.models import User
|
2022-02-06 16:09:17 +01:00
|
|
|
from app.comp import res_sem
|
2022-09-05 13:54:35 +02:00
|
|
|
from app.comp.res_cache import ResultatsCache
|
|
|
|
from app.comp.jury import ValidationsSemestre
|
2022-01-07 10:37:48 +01:00
|
|
|
from app.comp.moy_mod import ModuleImplResults
|
2022-05-18 20:43:01 +02:00
|
|
|
from app.models import FormSemestre, FormSemestreUECoef
|
2022-02-27 20:12:20 +01:00
|
|
|
from app.models import Identite
|
|
|
|
from app.models import ModuleImpl, ModuleImplInscription
|
2022-01-08 19:56:09 +01:00
|
|
|
from app.models.ues import UniteEns
|
2021-12-24 00:08:25 +01:00
|
|
|
from app.scodoc.sco_cache import ResultatsSemestreCache
|
2022-03-27 22:25:00 +02:00
|
|
|
from app.scodoc.sco_codes_parcours import UE_SPORT, DEF, DEM
|
2022-04-04 09:35:52 +02:00
|
|
|
from app.scodoc import sco_evaluation_db
|
2022-02-27 20:12:20 +01:00
|
|
|
from app.scodoc.sco_exceptions import ScoValueError
|
2022-03-27 22:25:00 +02:00
|
|
|
from app.scodoc import sco_groups
|
|
|
|
from app.scodoc import sco_utils as scu
|
2023-01-22 20:39:46 +01:00
|
|
|
from app.scodoc import table_builder as tb
|
2022-03-27 22:25:00 +02:00
|
|
|
|
2021-12-24 00:08:25 +01:00
|
|
|
# Il faut bien distinguer
|
|
|
|
# - ce qui est caché de façon persistente (via redis):
|
|
|
|
# ce sont les attributs listés dans `_cached_attrs`
|
|
|
|
# le stockage et l'invalidation sont gérés dans sco_cache.py
|
|
|
|
#
|
|
|
|
# - les valeurs cachées durant le temps d'une requête
|
|
|
|
# (durée de vie de l'instance de ResultatsSemestre)
|
|
|
|
# qui sont notamment les attributs décorés par `@cached_property``
|
|
|
|
#
|
2022-02-06 16:09:17 +01:00
|
|
|
class ResultatsSemestre(ResultatsCache):
|
2022-03-27 22:25:00 +02:00
|
|
|
"""Les résultats (notes, ...) d'un formsemestre
|
|
|
|
Classe commune à toutes les formations (classiques, BUT)
|
|
|
|
"""
|
|
|
|
|
2021-12-24 00:08:25 +01:00
|
|
|
_cached_attrs = (
|
2022-04-02 13:30:26 +02:00
|
|
|
"bonus",
|
|
|
|
"bonus_ues",
|
2022-12-01 13:00:14 +01:00
|
|
|
"dispense_ues",
|
|
|
|
"etud_coef_ue_df",
|
2021-12-30 23:58:38 +01:00
|
|
|
"etud_moy_gen_ranks",
|
|
|
|
"etud_moy_gen",
|
2021-12-24 00:08:25 +01:00
|
|
|
"etud_moy_ue",
|
2021-12-30 23:58:38 +01:00
|
|
|
"modimpl_inscr_df",
|
2021-12-26 19:15:47 +01:00
|
|
|
"modimpls_results",
|
2022-02-21 17:36:50 +01:00
|
|
|
"moyennes_matieres",
|
2021-12-24 00:08:25 +01:00
|
|
|
)
|
|
|
|
|
2021-12-30 23:58:38 +01:00
|
|
|
def __init__(self, formsemestre: FormSemestre):
|
2022-02-06 16:09:17 +01:00
|
|
|
super().__init__(formsemestre, ResultatsSemestreCache)
|
2021-12-26 19:15:47 +01:00
|
|
|
# BUT ou standard ? (apc == "approche par compétences")
|
|
|
|
self.is_apc = formsemestre.formation.is_apc()
|
2022-01-07 10:37:48 +01:00
|
|
|
# Attributs "virtuels", définis dans les sous-classes
|
2022-04-02 13:30:26 +02:00
|
|
|
self.bonus: pd.Series = None # virtuel
|
|
|
|
"Bonus sur moy. gen. Series de float, index etudid"
|
|
|
|
self.bonus_ues: pd.DataFrame = None # virtuel
|
|
|
|
"DataFrame de float, index etudid, columns: ue.id"
|
2022-12-01 13:00:14 +01:00
|
|
|
self.dispense_ues: set[tuple[int, int]] = set()
|
|
|
|
"""set des dispenses d'UE: (etudid, ue_id), en APC seulement."""
|
2022-01-08 19:56:09 +01:00
|
|
|
# ResultatsSemestreBUT ou ResultatsSemestreClassic
|
2021-12-26 19:15:47 +01:00
|
|
|
self.etud_moy_ue = {}
|
2022-01-08 19:56:09 +01:00
|
|
|
"etud_moy_ue: DataFrame columns UE, rows etudid"
|
2022-03-27 22:25:00 +02:00
|
|
|
self.etud_moy_gen: pd.Series = None
|
2021-12-26 19:15:47 +01:00
|
|
|
self.etud_moy_gen_ranks = {}
|
2022-02-13 13:58:09 +01:00
|
|
|
self.etud_moy_gen_ranks_int = {}
|
2022-05-23 10:59:43 +02:00
|
|
|
self.moy_gen_rangs_by_group = None # virtual
|
2022-03-27 22:25:00 +02:00
|
|
|
self.modimpl_inscr_df: pd.DataFrame = None
|
|
|
|
"Inscriptions: row etudid, col modimlpl_id"
|
2022-01-07 10:37:48 +01:00
|
|
|
self.modimpls_results: ModuleImplResults = None
|
2022-02-06 16:09:17 +01:00
|
|
|
"Résultats de chaque modimpl: dict { modimpl.id : ModuleImplResults(Classique ou BUT) }"
|
2022-01-16 23:47:52 +01:00
|
|
|
self.etud_coef_ue_df = None
|
2022-02-06 16:09:17 +01:00
|
|
|
"""coefs d'UE effectifs pour chaque étudiant (pour form. classiques)"""
|
2022-03-27 22:25:00 +02:00
|
|
|
self.modimpl_coefs_df: pd.DataFrame = None
|
|
|
|
"""Coefs APC: rows = UEs (sans bonus), columns = modimpl, value = coef."""
|
|
|
|
|
2022-02-07 16:32:04 +01:00
|
|
|
self.validations = None
|
2022-02-21 17:36:50 +01:00
|
|
|
self.moyennes_matieres = {}
|
|
|
|
"""Moyennes de matières, si calculées. { matiere_id : Series, index etudid }"""
|
2021-12-24 00:08:25 +01:00
|
|
|
|
2022-03-15 21:50:37 +01:00
|
|
|
def __repr__(self):
|
2022-03-21 19:41:14 +01:00
|
|
|
return f"<{self.__class__.__name__}(formsemestre='{self.formsemestre}')>"
|
2022-03-15 21:50:37 +01:00
|
|
|
|
2021-12-24 00:08:25 +01:00
|
|
|
def compute(self):
|
|
|
|
"Charge les notes et inscriptions et calcule toutes les moyennes"
|
|
|
|
# voir ce qui est chargé / calculé ici et dans les sous-classes
|
2021-12-26 19:15:47 +01:00
|
|
|
raise NotImplementedError()
|
2021-12-24 00:08:25 +01:00
|
|
|
|
2022-01-16 23:47:52 +01:00
|
|
|
def get_inscriptions_counts(self) -> Counter:
|
|
|
|
"""Nombre d'inscrits, défaillants, démissionnaires.
|
|
|
|
|
|
|
|
Exemple: res.get_inscriptions_counts()[scu.INSCRIT]
|
|
|
|
|
|
|
|
Result: a collections.Counter instance
|
|
|
|
"""
|
|
|
|
return Counter(ins.etat for ins in self.formsemestre.inscriptions)
|
|
|
|
|
2021-12-24 00:08:25 +01:00
|
|
|
@cached_property
|
2022-01-16 23:47:52 +01:00
|
|
|
def etuds(self) -> list[Identite]:
|
|
|
|
"Liste des inscrits au semestre, avec les démissionnaires et les défaillants"
|
2021-12-30 23:58:38 +01:00
|
|
|
# nb: si la liste des inscrits change, ResultatsSemestre devient invalide
|
2022-01-16 23:47:52 +01:00
|
|
|
return self.formsemestre.get_inscrits(include_demdef=True)
|
2021-12-24 00:08:25 +01:00
|
|
|
|
|
|
|
@cached_property
|
2022-01-16 23:47:52 +01:00
|
|
|
def etud_index(self) -> dict[int, int]:
|
2021-12-24 00:08:25 +01:00
|
|
|
"dict { etudid : indice dans les inscrits }"
|
|
|
|
return {e.id: idx for idx, e in enumerate(self.etuds)}
|
|
|
|
|
2022-06-02 10:48:28 +02:00
|
|
|
def etud_ues_ids(self, etudid: int) -> list[int]:
|
2022-06-02 03:14:13 +02:00
|
|
|
"""Liste des UE auxquelles l'etudiant est inscrit, sans bonus
|
|
|
|
(surchargée en BUT pour prendre en compte les parcours)
|
|
|
|
"""
|
|
|
|
# Pour les formations classiques, etudid n'est pas utilisé
|
|
|
|
# car tous les étudiants sont inscrits à toutes les UE
|
|
|
|
return [ue.id for ue in self.ues if ue.type != UE_SPORT]
|
|
|
|
|
2022-07-18 17:48:10 +02:00
|
|
|
def etud_ues(self, etudid: int) -> Generator[UniteEns]:
|
|
|
|
"""Liste des UE auxquelles l'étudiant est inscrit."""
|
|
|
|
return (UniteEns.query.get(ue_id) for ue_id in self.etud_ues_ids(etudid))
|
|
|
|
|
|
|
|
def etud_ects_tot_sem(self, etudid: int) -> float:
|
|
|
|
"""Le total des ECTS associées à ce semestre (que l'étudiant peut ou non valider)"""
|
|
|
|
etud_ues = self.etud_ues(etudid)
|
|
|
|
return sum([ue.ects or 0 for ue in etud_ues]) if etud_ues else 0.0
|
|
|
|
|
2022-04-02 13:30:26 +02:00
|
|
|
def modimpl_notes(self, modimpl_id: int, ue_id: int) -> np.ndarray:
|
|
|
|
"""Les notes moyennes des étudiants du sem. à ce modimpl dans cette ue.
|
|
|
|
Utile pour stats bottom tableau recap.
|
|
|
|
Résultat: 1d array of float
|
|
|
|
"""
|
|
|
|
# différent en BUT et classique: virtuelle
|
|
|
|
raise NotImplementedError
|
|
|
|
|
2022-01-09 21:02:07 +01:00
|
|
|
@cached_property
|
2022-01-16 23:47:52 +01:00
|
|
|
def etuds_dict(self) -> dict[int, Identite]:
|
|
|
|
"""dict { etudid : Identite } inscrits au semestre,
|
|
|
|
avec les démissionnaires et defs."""
|
2022-01-09 21:02:07 +01:00
|
|
|
return {etud.id: etud for etud in self.etuds}
|
|
|
|
|
2021-12-24 00:08:25 +01:00
|
|
|
@cached_property
|
2022-01-16 23:47:52 +01:00
|
|
|
def ues(self) -> list[UniteEns]:
|
2022-01-25 10:45:13 +01:00
|
|
|
"""Liste des UEs du semestre (avec les UE bonus sport)
|
2022-02-06 16:09:17 +01:00
|
|
|
(indices des DataFrames).
|
|
|
|
Note: un étudiant n'est pas nécessairement inscrit dans toutes ces UEs.
|
2022-01-09 21:02:07 +01:00
|
|
|
"""
|
|
|
|
return self.formsemestre.query_ues(with_sport=True).all()
|
2021-12-24 00:08:25 +01:00
|
|
|
|
|
|
|
@cached_property
|
|
|
|
def ressources(self):
|
|
|
|
"Liste des ressources du semestre, triées par numéro de module"
|
|
|
|
return [
|
2022-01-25 10:45:13 +01:00
|
|
|
m
|
|
|
|
for m in self.formsemestre.modimpls_sorted
|
|
|
|
if m.module.module_type == scu.ModuleType.RESSOURCE
|
2021-12-24 00:08:25 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
@cached_property
|
|
|
|
def saes(self):
|
|
|
|
"Liste des SAÉs du semestre, triées par numéro de module"
|
2022-01-25 10:45:13 +01:00
|
|
|
return [
|
|
|
|
m
|
|
|
|
for m in self.formsemestre.modimpls_sorted
|
|
|
|
if m.module.module_type == scu.ModuleType.SAE
|
|
|
|
]
|
2021-12-24 00:08:25 +01:00
|
|
|
|
2022-05-18 20:43:01 +02:00
|
|
|
# --- JURY...
|
2022-09-05 13:54:35 +02:00
|
|
|
def load_validations(self) -> ValidationsSemestre:
|
|
|
|
"""Load validations, set attribute and return value"""
|
|
|
|
if not self.validations:
|
|
|
|
self.validations = res_sem.load_formsemestre_validations(self.formsemestre)
|
|
|
|
return self.validations
|
|
|
|
|
2022-02-06 16:09:17 +01:00
|
|
|
def get_etud_ue_validables(self, etudid: int) -> list[UniteEns]:
|
|
|
|
"""Liste des UEs du semestre qui doivent être validées
|
|
|
|
|
|
|
|
Rappel: l'étudiant est inscrit à des modimpls et non à des UEs.
|
|
|
|
|
|
|
|
- En BUT: on considère que l'étudiant va (ou non) valider toutes les UEs des modules
|
2022-07-19 10:28:22 +02:00
|
|
|
du parcours.
|
2022-02-06 16:09:17 +01:00
|
|
|
|
2022-03-22 08:58:47 +01:00
|
|
|
- En classique: toutes les UEs des modimpls auxquels l'étudiant est inscrit sont
|
2022-02-06 16:09:17 +01:00
|
|
|
susceptibles d'être validées.
|
|
|
|
|
|
|
|
Les UE "bonus" (sport) ne sont jamais "validables".
|
2022-01-08 19:56:09 +01:00
|
|
|
"""
|
2022-02-06 16:09:17 +01:00
|
|
|
if self.is_apc:
|
2022-07-19 10:28:22 +02:00
|
|
|
return list(self.etud_ues(etudid))
|
|
|
|
# Formations classiques:
|
|
|
|
# restreint aux UE auxquelles l'étudiant est inscrit (dans l'un des modimpls)
|
|
|
|
ues = {
|
|
|
|
modimpl.module.ue
|
|
|
|
for modimpl in self.formsemestre.modimpls_sorted
|
|
|
|
if self.modimpl_inscr_df[modimpl.id][etudid]
|
|
|
|
}
|
|
|
|
ues = sorted(list(ues), key=lambda x: x.numero or 0)
|
|
|
|
return ues
|
2022-01-08 19:56:09 +01:00
|
|
|
|
2022-06-25 23:22:20 +02:00
|
|
|
def modimpls_in_ue(self, ue: UniteEns, etudid, with_bonus=True) -> list[ModuleImpl]:
|
2022-03-12 09:38:48 +01:00
|
|
|
"""Liste des modimpl de cette UE auxquels l'étudiant est inscrit.
|
|
|
|
Utile en formations classiques, surchargée pour le BUT.
|
2022-03-27 22:25:00 +02:00
|
|
|
Inclus modules bonus le cas échéant.
|
2022-03-12 09:38:48 +01:00
|
|
|
"""
|
2022-07-19 10:28:22 +02:00
|
|
|
# Utilisée pour l'affichage ou non de l'UE sur le bulletin
|
2022-03-27 22:25:00 +02:00
|
|
|
# Méthode surchargée en BUT
|
|
|
|
modimpls = [
|
2022-01-29 23:36:07 +01:00
|
|
|
modimpl
|
|
|
|
for modimpl in self.formsemestre.modimpls_sorted
|
2022-06-25 23:22:20 +02:00
|
|
|
if modimpl.module.ue.id == ue.id
|
2022-01-29 23:36:07 +01:00
|
|
|
and self.modimpl_inscr_df[modimpl.id][etudid]
|
|
|
|
]
|
2022-03-27 22:25:00 +02:00
|
|
|
if not with_bonus:
|
|
|
|
return [
|
|
|
|
modimpl for modimpl in modimpls if modimpl.module.ue.type != UE_SPORT
|
|
|
|
]
|
|
|
|
return modimpls
|
2022-01-29 23:36:07 +01:00
|
|
|
|
2022-01-08 19:56:09 +01:00
|
|
|
@cached_property
|
|
|
|
def ue_au_dessus(self, seuil=10.0) -> pd.DataFrame:
|
|
|
|
"""DataFrame columns UE, rows etudid, valeurs: bool
|
|
|
|
Par exemple, pour avoir le nombre d'UE au dessus de 10 pour l'étudiant etudid
|
|
|
|
nb_ues_ok = sum(res.ue_au_dessus().loc[etudid])
|
|
|
|
"""
|
|
|
|
return self.etud_moy_ue > (seuil - scu.NOTES_TOLERANCE)
|
|
|
|
|
2022-02-07 16:32:04 +01:00
|
|
|
def apply_capitalisation(self):
|
|
|
|
"""Recalcule la moyenne générale pour prendre en compte d'éventuelles
|
|
|
|
UE capitalisées.
|
|
|
|
"""
|
|
|
|
# Supposant qu'il y a peu d'UE capitalisées,
|
2022-09-03 20:48:56 +02:00
|
|
|
# on recalcule les moyennes gen des etuds ayant des UE capitalisée.
|
2022-09-05 13:54:35 +02:00
|
|
|
self.load_validations()
|
2022-02-07 16:32:04 +01:00
|
|
|
ue_capitalisees = self.validations.ue_capitalisees
|
|
|
|
for etudid in ue_capitalisees.index:
|
|
|
|
recompute_mg = False
|
|
|
|
# ue_codes = set(ue_capitalisees.loc[etudid]["ue_code"])
|
|
|
|
# for ue_code in ue_codes:
|
|
|
|
# ue = ue_by_code.get(ue_code)
|
|
|
|
# if ue is None:
|
|
|
|
# ue = self.formsemestre.query_ues.filter_by(ue_code=ue_code)
|
|
|
|
# ue_by_code[ue_code] = ue
|
|
|
|
|
|
|
|
# Quand il y a une capitalisation, vérifie toutes les UEs
|
|
|
|
sum_notes_ue = 0.0
|
|
|
|
sum_coefs_ue = 0.0
|
|
|
|
for ue in self.formsemestre.query_ues():
|
|
|
|
ue_cap = self.get_etud_ue_status(etudid, ue.id)
|
2022-02-21 15:10:10 +01:00
|
|
|
if ue_cap is None:
|
|
|
|
continue
|
|
|
|
if ue_cap["is_capitalized"]:
|
2022-02-07 16:32:04 +01:00
|
|
|
recompute_mg = True
|
|
|
|
coef = ue_cap["coef_ue"]
|
2022-02-28 15:07:48 +01:00
|
|
|
if not np.isnan(ue_cap["moy"]) and coef:
|
2022-02-07 16:32:04 +01:00
|
|
|
sum_notes_ue += ue_cap["moy"] * coef
|
|
|
|
sum_coefs_ue += coef
|
|
|
|
|
|
|
|
if recompute_mg and sum_coefs_ue > 0.0:
|
|
|
|
# On doit prendre en compte une ou plusieurs UE capitalisées
|
|
|
|
# et donc recalculer la moyenne générale
|
|
|
|
self.etud_moy_gen[etudid] = sum_notes_ue / sum_coefs_ue
|
2022-02-21 15:10:10 +01:00
|
|
|
# Ajoute le bonus sport
|
|
|
|
if self.bonus is not None and self.bonus[etudid]:
|
|
|
|
self.etud_moy_gen[etudid] += self.bonus[etudid]
|
|
|
|
self.etud_moy_gen[etudid] = max(
|
|
|
|
0.0, min(self.etud_moy_gen[etudid], 20.0)
|
|
|
|
)
|
2022-02-07 16:32:04 +01:00
|
|
|
|
2022-04-02 13:30:26 +02:00
|
|
|
def get_etud_etat(self, etudid: int) -> str:
|
|
|
|
"Etat de l'etudiant: 'I', 'D', DEF ou '' (si pas connu dans ce semestre)"
|
|
|
|
ins = self.formsemestre.etuds_inscriptions.get(etudid, None)
|
|
|
|
if ins is None:
|
|
|
|
return ""
|
|
|
|
return ins.etat
|
|
|
|
|
2022-02-27 20:12:20 +01:00
|
|
|
def _get_etud_ue_cap(self, etudid: int, ue: UniteEns) -> dict:
|
|
|
|
"""Donne les informations sur la capitalisation de l'UE ue pour cet étudiant.
|
|
|
|
Résultat:
|
|
|
|
Si pas capitalisée: None
|
|
|
|
Si capitalisée: un dict, avec les colonnes de validation.
|
|
|
|
"""
|
2022-02-07 16:32:04 +01:00
|
|
|
capitalisations = self.validations.ue_capitalisees.loc[etudid]
|
|
|
|
if isinstance(capitalisations, pd.DataFrame):
|
|
|
|
ue_cap = capitalisations[capitalisations["ue_code"] == ue.ue_code]
|
2022-02-27 20:12:20 +01:00
|
|
|
if ue_cap.empty:
|
|
|
|
return None
|
|
|
|
if isinstance(ue_cap, pd.DataFrame):
|
2022-02-07 16:32:04 +01:00
|
|
|
# si plusieurs fois capitalisée, prend le max
|
|
|
|
cap_idx = ue_cap["moy_ue"].values.argmax()
|
|
|
|
ue_cap = ue_cap.iloc[cap_idx]
|
|
|
|
else:
|
|
|
|
if capitalisations["ue_code"] == ue.ue_code:
|
|
|
|
ue_cap = capitalisations
|
|
|
|
else:
|
2022-02-27 20:12:20 +01:00
|
|
|
return None
|
|
|
|
# converti la Series en dict, afin que les np.int64 reviennent en int
|
2022-07-11 17:15:36 +02:00
|
|
|
# et remplace les NaN (venant des NULL en base) par des None
|
|
|
|
ue_cap_dict = ue_cap.to_dict()
|
|
|
|
if ue_cap_dict["formsemestre_id"] is not None and np.isnan(
|
|
|
|
ue_cap_dict["formsemestre_id"]
|
|
|
|
):
|
|
|
|
ue_cap_dict["formsemestre_id"] = None
|
|
|
|
if ue_cap_dict["compense_formsemestre_id"] is not None and np.isnan(
|
|
|
|
ue_cap_dict["compense_formsemestre_id"]
|
|
|
|
):
|
|
|
|
ue_cap_dict["compense_formsemestre_id"] = None
|
|
|
|
return ue_cap_dict
|
2022-02-07 16:32:04 +01:00
|
|
|
|
|
|
|
def get_etud_ue_status(self, etudid: int, ue_id: int) -> dict:
|
|
|
|
"""L'état de l'UE pour cet étudiant.
|
2022-02-11 23:12:40 +01:00
|
|
|
Result: dict, ou None si l'UE n'est pas dans ce semestre.
|
2022-02-07 16:32:04 +01:00
|
|
|
"""
|
2022-11-24 00:11:59 +01:00
|
|
|
ue = UniteEns.query.get(ue_id)
|
2022-02-09 00:36:50 +01:00
|
|
|
if ue.type == UE_SPORT:
|
|
|
|
return {
|
|
|
|
"is_capitalized": False,
|
2022-02-13 15:50:16 +01:00
|
|
|
"was_capitalized": False,
|
2022-02-09 00:36:50 +01:00
|
|
|
"is_external": False,
|
|
|
|
"coef_ue": 0.0,
|
|
|
|
"cur_moy_ue": 0.0,
|
|
|
|
"moy": 0.0,
|
|
|
|
"event_date": None,
|
|
|
|
"ue": ue.to_dict(),
|
|
|
|
"formsemestre_id": None,
|
|
|
|
"capitalized_ue_id": None,
|
2022-02-09 18:43:03 +01:00
|
|
|
"ects_pot": 0.0,
|
2022-07-19 10:28:22 +02:00
|
|
|
"ects": 0.0,
|
|
|
|
"ects_ue": ue.ects,
|
2022-02-09 00:36:50 +01:00
|
|
|
}
|
2022-02-12 10:31:52 +01:00
|
|
|
if not ue_id in self.etud_moy_ue:
|
|
|
|
return None
|
|
|
|
if not self.validations:
|
|
|
|
self.validations = res_sem.load_formsemestre_validations(self.formsemestre)
|
2022-02-07 16:32:04 +01:00
|
|
|
cur_moy_ue = self.etud_moy_ue[ue_id][etudid]
|
|
|
|
moy_ue = cur_moy_ue
|
2022-02-13 15:50:16 +01:00
|
|
|
is_capitalized = False # si l'UE prise en compte est une UE capitalisée
|
2022-02-28 11:00:24 +01:00
|
|
|
# s'il y a precedemment une UE capitalisée (pas forcement meilleure):
|
|
|
|
was_capitalized = False
|
2022-02-07 16:32:04 +01:00
|
|
|
if etudid in self.validations.ue_capitalisees.index:
|
|
|
|
ue_cap = self._get_etud_ue_cap(etudid, ue)
|
2022-02-27 20:12:20 +01:00
|
|
|
if ue_cap and not np.isnan(ue_cap["moy_ue"]):
|
2022-02-13 15:50:16 +01:00
|
|
|
was_capitalized = True
|
2022-02-09 18:43:03 +01:00
|
|
|
if ue_cap["moy_ue"] > cur_moy_ue or np.isnan(cur_moy_ue):
|
2022-02-07 16:32:04 +01:00
|
|
|
moy_ue = ue_cap["moy_ue"]
|
|
|
|
is_capitalized = True
|
2022-02-09 18:43:03 +01:00
|
|
|
|
2022-02-27 20:12:20 +01:00
|
|
|
# Coef l'UE dans le semestre courant:
|
|
|
|
if self.is_apc:
|
|
|
|
# utilise les ECTS comme coef.
|
|
|
|
coef_ue = ue.ects
|
|
|
|
else:
|
|
|
|
# formations classiques
|
|
|
|
coef_ue = self.etud_coef_ue_df[ue_id][etudid]
|
|
|
|
if (not coef_ue) and is_capitalized: # étudiant non inscrit dans l'UE courante
|
|
|
|
if self.is_apc:
|
|
|
|
# Coefs de l'UE capitalisée en formation APC: donné par ses ECTS
|
|
|
|
ue_capitalized = UniteEns.query.get(ue_cap["ue_id"])
|
|
|
|
coef_ue = ue_capitalized.ects
|
|
|
|
if coef_ue is None:
|
|
|
|
orig_sem = FormSemestre.query.get(ue_cap["formsemestre_id"])
|
|
|
|
raise ScoValueError(
|
2022-04-02 13:30:26 +02:00
|
|
|
f"""L'UE capitalisée {ue_capitalized.acronyme}
|
2022-02-27 20:12:20 +01:00
|
|
|
du semestre {orig_sem.titre_annee()}
|
|
|
|
n'a pas d'indication d'ECTS.
|
2022-04-02 13:30:26 +02:00
|
|
|
Corrigez ou faite corriger le programme
|
|
|
|
<a href="{url_for('notes.ue_table', scodoc_dept=g.scodoc_dept,
|
2022-02-27 20:12:20 +01:00
|
|
|
formation_id=ue_capitalized.formation_id)}">via cette page</a>.
|
|
|
|
"""
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
# Coefs de l'UE capitalisée en formation classique:
|
|
|
|
# va chercher le coef dans le semestre d'origine
|
|
|
|
coef_ue = ModuleImplInscription.sum_coefs_modimpl_ue(
|
|
|
|
ue_cap["formsemestre_id"], etudid, ue_cap["ue_id"]
|
|
|
|
)
|
2022-02-07 16:32:04 +01:00
|
|
|
|
|
|
|
return {
|
|
|
|
"is_capitalized": is_capitalized,
|
2022-02-13 15:50:16 +01:00
|
|
|
"was_capitalized": was_capitalized,
|
2022-02-07 16:32:04 +01:00
|
|
|
"is_external": ue_cap["is_external"] if is_capitalized else ue.is_external,
|
|
|
|
"coef_ue": coef_ue,
|
2022-02-09 18:43:03 +01:00
|
|
|
"ects_pot": ue.ects or 0.0,
|
2022-07-19 10:28:22 +02:00
|
|
|
"ects": self.validations.decisions_jury_ues.get(etudid, {})
|
|
|
|
.get(ue.id, {})
|
|
|
|
.get("ects", 0.0)
|
|
|
|
if self.validations.decisions_jury_ues
|
|
|
|
else 0.0,
|
|
|
|
"ects_ue": ue.ects,
|
2022-02-07 16:32:04 +01:00
|
|
|
"cur_moy_ue": cur_moy_ue,
|
|
|
|
"moy": moy_ue,
|
|
|
|
"event_date": ue_cap["event_date"] if is_capitalized else None,
|
|
|
|
"ue": ue.to_dict(),
|
|
|
|
"formsemestre_id": ue_cap["formsemestre_id"] if is_capitalized else None,
|
|
|
|
"capitalized_ue_id": ue_cap["ue_id"] if is_capitalized else None,
|
|
|
|
}
|
|
|
|
|
2022-04-02 13:30:26 +02:00
|
|
|
def compute_etud_ue_coef(self, etudid: int, ue: UniteEns) -> float:
|
|
|
|
"Détermine le coefficient de l'UE pour cet étudiant."
|
2022-09-03 20:48:56 +02:00
|
|
|
# calcul différent en classique et BUT
|
2022-04-02 13:30:26 +02:00
|
|
|
raise NotImplementedError()
|
|
|
|
|
2022-09-03 20:48:56 +02:00
|
|
|
def get_etud_ue_cap_coef(self, etudid, ue, ue_cap): # UNUSED in ScoDoc 9
|
2022-02-07 16:32:04 +01:00
|
|
|
"""Calcule le coefficient d'une UE capitalisée, pour cet étudiant,
|
|
|
|
injectée dans le semestre courant.
|
|
|
|
|
|
|
|
ue : ue du semestre courant
|
|
|
|
|
|
|
|
ue_cap = resultat de formsemestre_get_etud_capitalisation
|
|
|
|
{ 'ue_id' (dans le semestre source),
|
|
|
|
'ue_code', 'moy', 'event_date','formsemestre_id' }
|
|
|
|
"""
|
|
|
|
# 1- Coefficient explicitement déclaré dans le semestre courant pour cette UE ?
|
|
|
|
ue_coef_db = FormSemestreUECoef.query.filter_by(
|
|
|
|
formsemestre_id=self.formsemestre.id, ue_id=ue.id
|
|
|
|
).first()
|
|
|
|
if ue_coef_db is not None:
|
|
|
|
return ue_coef_db.coefficient
|
|
|
|
|
|
|
|
# En APC: somme des coefs des modules vers cette UE
|
|
|
|
# En classique: Capitalisation UE externe: quel coef appliquer ?
|
|
|
|
# En ScoDoc 7, calculait la somme des coefs dans l'UE du semestre d'origine
|
|
|
|
# ici si l'étudiant est inscrit dans le semestre courant,
|
|
|
|
# somme des coefs des modules de l'UE auxquels il est inscrit
|
|
|
|
return self.compute_etud_ue_coef(etudid, ue)
|
|
|
|
|
2022-03-27 22:25:00 +02:00
|
|
|
# --- TABLEAU RECAP
|
|
|
|
|
2022-04-07 23:31:08 +02:00
|
|
|
def get_table_recap(
|
2022-07-21 16:46:07 +02:00
|
|
|
self,
|
|
|
|
convert_values=False,
|
|
|
|
include_evaluations=False,
|
|
|
|
mode_jury=False,
|
2023-01-22 20:39:46 +01:00
|
|
|
) -> tb.Table:
|
2022-07-21 16:46:07 +02:00
|
|
|
"""Table récap. des résultats.
|
2022-10-31 16:26:36 +01:00
|
|
|
allow_html: si vrai, peut mettre du HTML dans les valeurs
|
2022-07-21 16:46:07 +02:00
|
|
|
|
2023-01-29 21:52:39 +01:00
|
|
|
Result: Table, le contenu étant une ligne par étudiant.
|
|
|
|
|
2022-03-27 22:25:00 +02:00
|
|
|
|
2022-05-29 17:38:52 +02:00
|
|
|
Si convert_values, transforme les notes en chaines ("12.34").
|
2022-03-27 22:25:00 +02:00
|
|
|
Les colonnes générées sont:
|
|
|
|
etudid
|
|
|
|
rang : rang indicatif (basé sur moy gen)
|
|
|
|
moy_gen : moy gen indicative
|
|
|
|
moy_ue_<ue_id>, ..., les moyennes d'UE
|
|
|
|
moy_res_<modimpl_id>_<ue_id>, ... les moyennes de ressources dans l'UE
|
|
|
|
moy_sae_<modimpl_id>_<ue_id>, ... les moyennes de SAE dans l'UE
|
|
|
|
|
2023-01-29 21:52:39 +01:00
|
|
|
On ajoute aussi des classes:
|
2022-03-27 22:25:00 +02:00
|
|
|
- pour les lignes:
|
2023-01-29 21:52:39 +01:00
|
|
|
selected_row pour l'étudiant sélectionné
|
|
|
|
- les colonnes:
|
|
|
|
- la moyenne générale a la classe col_moy_gen
|
|
|
|
- les colonnes SAE ont la classe col_sae
|
|
|
|
- les colonnes Resources ont la classe col_res
|
|
|
|
- les colonnes d'UE ont la classe col_ue
|
|
|
|
- les colonnes de modules (SAE ou res.) d'une UE ont la classe mod_ue_<ue_id>
|
2022-02-06 18:29:22 +01:00
|
|
|
"""
|
2021-12-24 00:08:25 +01:00
|
|
|
|
2021-12-30 23:58:38 +01:00
|
|
|
etuds_inscriptions = self.formsemestre.etuds_inscriptions
|
2022-02-10 23:15:03 +01:00
|
|
|
ues = self.formsemestre.query_ues(with_sport=True) # avec bonus
|
2022-04-02 14:26:16 +02:00
|
|
|
ues_sans_bonus = [ue for ue in ues if ue.type != UE_SPORT]
|
2023-01-29 21:52:39 +01:00
|
|
|
|
2023-01-22 20:39:46 +01:00
|
|
|
table = tb.Table()
|
2023-01-29 21:52:39 +01:00
|
|
|
# Quelques infos stockées dans la Table
|
|
|
|
parcours = self.formsemestre.formation.get_parcours()
|
|
|
|
table.barre_moy = parcours.BARRE_MOY - scu.NOTES_TOLERANCE
|
|
|
|
table.barre_valid_ue = parcours.NOTES_BARRE_VALID_UE
|
|
|
|
table.barre_warning_ue = parcours.BARRE_UE_DISPLAY_WARNING
|
|
|
|
table.cache_nomcomplet = {} # cache uid : nomcomplet
|
|
|
|
if convert_values:
|
|
|
|
table.fmt_note = scu.fmt_note
|
|
|
|
else:
|
|
|
|
table.fmt_note = lambda x: x
|
|
|
|
# couples (modimpl, ue) effectivement présents dans la table:
|
|
|
|
table.modimpl_ue_ids = set()
|
|
|
|
|
2021-12-30 23:58:38 +01:00
|
|
|
for etudid in etuds_inscriptions:
|
2022-03-27 22:25:00 +02:00
|
|
|
etud = Identite.query.get(etudid)
|
2023-01-22 20:39:46 +01:00
|
|
|
row = tb.Row(table, etudid)
|
|
|
|
table.add_row(row)
|
2023-01-29 21:52:39 +01:00
|
|
|
self._recap_add_etud(row, etud)
|
|
|
|
self._recap_add_moyennes(row, etud, ues_sans_bonus, mode_jury)
|
2022-04-03 16:20:16 +02:00
|
|
|
|
2023-01-22 20:39:46 +01:00
|
|
|
self.recap_add_partitions(table)
|
|
|
|
self.recap_add_cursus(table)
|
|
|
|
self._recap_add_admissions(table)
|
2022-04-04 09:35:52 +02:00
|
|
|
|
2022-03-27 22:25:00 +02:00
|
|
|
# tri par rang croissant
|
2023-01-13 23:50:24 +01:00
|
|
|
if not self.formsemestre.block_moyenne_generale:
|
2023-01-29 21:52:39 +01:00
|
|
|
table.sort_rows(key=lambda row: row.rang_order)
|
2023-01-13 23:50:24 +01:00
|
|
|
else:
|
2023-01-29 21:52:39 +01:00
|
|
|
table.sort_rows(key=lambda row: row.nb_ues_validables, reverse=True)
|
2022-03-27 22:25:00 +02:00
|
|
|
|
2023-01-29 21:52:39 +01:00
|
|
|
# Lignes footer (min, max, ects, apo, ...)
|
|
|
|
self._recap_add_bottom_rows(table, ues_sans_bonus)
|
|
|
|
|
|
|
|
# Evaluations:
|
2022-04-04 09:35:52 +02:00
|
|
|
if include_evaluations:
|
2023-01-22 20:39:46 +01:00
|
|
|
self._recap_add_evaluations(table)
|
2021-12-30 23:58:38 +01:00
|
|
|
|
2022-04-03 16:20:16 +02:00
|
|
|
# Ajoute style "col_empty" aux colonnes de modules vides
|
2023-01-22 20:39:46 +01:00
|
|
|
row_moy = table.get_row_by_id("moy")
|
|
|
|
for col_id in table.column_ids:
|
2023-01-29 21:52:39 +01:00
|
|
|
cell: tb.Cell = row_moy.cells.get(col_id)
|
|
|
|
if cell and "col_empty" in cell.classes:
|
2023-01-22 20:39:46 +01:00
|
|
|
table.column_classes[col_id].append("col_empty")
|
2022-04-03 16:20:16 +02:00
|
|
|
|
2023-01-14 21:56:41 +01:00
|
|
|
# Ligne avec la classe de chaque colonne
|
|
|
|
# récupère le type à partir des classes css (hack...)
|
2023-01-22 20:39:46 +01:00
|
|
|
row_type = tb.BottomRow(
|
|
|
|
table,
|
|
|
|
"type_col",
|
2023-01-29 21:52:39 +01:00
|
|
|
left_title="Type col.",
|
2023-01-22 20:39:46 +01:00
|
|
|
left_title_col_ids=["prenom", "nom_short"],
|
|
|
|
category="bottom_infos",
|
|
|
|
classes=["bottom_info"],
|
2022-04-03 16:20:16 +02:00
|
|
|
)
|
2023-01-22 20:39:46 +01:00
|
|
|
for col_id in table.column_ids:
|
|
|
|
group_name = table.column_group.get(col_id, "")
|
|
|
|
if group_name.startswith("col_"):
|
|
|
|
group_name = group_name[4:]
|
|
|
|
row_type.add_cell(col_id, None, group_name)
|
|
|
|
|
|
|
|
return table
|
|
|
|
|
2023-01-29 21:52:39 +01:00
|
|
|
def _recap_add_etud(self, row: tb.Row, etud: Identite):
|
|
|
|
"""Ajoute colonnes étudiant: codes, noms"""
|
|
|
|
# --- Codes (seront cachés, mais exportés en excel)
|
|
|
|
row.add_cell("etudid", "etudid", etud.id, "etud_codes")
|
|
|
|
row.add_cell(
|
|
|
|
"code_nip",
|
|
|
|
"code_nip",
|
|
|
|
etud.code_nip or "",
|
|
|
|
"etud_codes",
|
|
|
|
)
|
|
|
|
|
|
|
|
# --- Rang
|
|
|
|
if not self.formsemestre.block_moyenne_generale:
|
|
|
|
row.rang_order = self.etud_moy_gen_ranks_int[etud.id]
|
|
|
|
row.add_cell(
|
|
|
|
"rang",
|
|
|
|
"Rg",
|
|
|
|
self.etud_moy_gen_ranks[etud.id],
|
|
|
|
"rang",
|
|
|
|
data={"order": f"{row.rang_order:05d}"},
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
row.rang_order = -1
|
|
|
|
# --- Identité étudiant
|
|
|
|
url_bulletin = url_for(
|
|
|
|
"notes.formsemestre_bulletinetud",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=self.formsemestre.id,
|
|
|
|
etudid=etud.id,
|
|
|
|
)
|
|
|
|
row.add_cell("civilite_str", "Civ.", etud.civilite_str, "identite_detail")
|
|
|
|
row.add_cell(
|
|
|
|
"nom_disp",
|
|
|
|
"Nom",
|
|
|
|
etud.nom_disp(),
|
|
|
|
"identite_detail",
|
|
|
|
data={"order": etud.sort_key},
|
|
|
|
target=url_bulletin,
|
|
|
|
target_attrs={"class": "etudinfo", "id": str(etud.id)},
|
|
|
|
)
|
|
|
|
row.add_cell("prenom", "Prénom", etud.prenom, "identite_detail")
|
|
|
|
row.add_cell(
|
|
|
|
"nom_short",
|
|
|
|
"Nom",
|
|
|
|
etud.nom_short,
|
|
|
|
"identite_court",
|
|
|
|
data={
|
|
|
|
"order": etud.sort_key,
|
|
|
|
"etudid": etud.id,
|
|
|
|
"nomprenom": etud.nomprenom,
|
|
|
|
},
|
|
|
|
target=url_bulletin,
|
|
|
|
target_attrs={"class": "etudinfo", "id": str(etud.id)},
|
|
|
|
)
|
|
|
|
|
|
|
|
def _recap_add_moyennes(
|
|
|
|
self,
|
|
|
|
row: tb.Row,
|
|
|
|
etud: Identite,
|
|
|
|
ues_sans_bonus: list[UniteEns],
|
|
|
|
mode_jury=False,
|
|
|
|
):
|
|
|
|
"""Ajoute cols moy_gen moy_ue et tous les modules..."""
|
|
|
|
table = row.table
|
|
|
|
|
|
|
|
# --- Moyenne générale
|
|
|
|
if not self.formsemestre.block_moyenne_generale:
|
|
|
|
moy_gen = self.etud_moy_gen.get(etud.id, False)
|
|
|
|
note_class = ""
|
|
|
|
if moy_gen is False:
|
|
|
|
moy_gen = scu.NO_NOTE_STR
|
|
|
|
elif isinstance(moy_gen, float) and moy_gen < table.barre_moy:
|
|
|
|
note_class = "moy_ue_warning" # en rouge
|
|
|
|
row.add_cell(
|
|
|
|
"moy_gen",
|
|
|
|
"Moy",
|
|
|
|
table.fmt_note(moy_gen),
|
|
|
|
"col_moy_gen",
|
|
|
|
classes=[note_class],
|
|
|
|
)
|
|
|
|
# Ajoute bulle sur titre du pied de table:
|
|
|
|
if self.is_apc:
|
|
|
|
table.foot_title_row.cells["moy_gen"].target_attrs[
|
|
|
|
"title"
|
|
|
|
] = "moyenne indicative"
|
|
|
|
|
|
|
|
# --- Moyenne d'UE
|
|
|
|
row.nb_ues_validables, row.nb_ues_warning = 0, 0
|
|
|
|
for ue in ues_sans_bonus:
|
|
|
|
ue_status = self.get_etud_ue_status(etud.id, ue.id)
|
|
|
|
if ue_status is not None:
|
|
|
|
self._recap_add_ue(row, ue, ue_status)
|
|
|
|
if mode_jury:
|
|
|
|
# pas d'autre colonnes de résultats
|
|
|
|
continue
|
|
|
|
|
|
|
|
# Bonus (sport) dans cette UE ?
|
|
|
|
# Le bonus sport appliqué sur cette UE
|
|
|
|
if (self.bonus_ues is not None) and (ue.id in self.bonus_ues):
|
|
|
|
val = self.bonus_ues[ue.id][etud.id] or ""
|
|
|
|
val_fmt = val_fmt_html = table.fmt_note(val)
|
|
|
|
if val:
|
|
|
|
val_fmt_html = f"""<span class="green-arrow-up"></span><span class="sp2l">{
|
|
|
|
val_fmt
|
|
|
|
}</span>"""
|
|
|
|
row.add_cell(
|
|
|
|
f"bonus_ue_{ue.id}",
|
|
|
|
f"Bonus {ue.acronyme}",
|
|
|
|
val_fmt_html,
|
|
|
|
raw_content=val_fmt,
|
|
|
|
group=f"col_ue_{ue.id}",
|
|
|
|
classes=["col_ue_bonus"],
|
|
|
|
)
|
|
|
|
# Les moyennes des modules (ou ressources et SAÉs) dans cette UE
|
|
|
|
self._recap_add_ue_modimpls(row, ue, etud, ue_status["is_capitalized"])
|
|
|
|
|
|
|
|
row.nb_ues_etud_parcours = len(self.etud_ues_ids(etud.id))
|
|
|
|
ue_valid_txt = (
|
|
|
|
ue_valid_txt_html
|
|
|
|
) = f"{row.nb_ues_validables}/{row.nb_ues_etud_parcours}"
|
|
|
|
if row.nb_ues_warning:
|
|
|
|
ue_valid_txt_html += " " + scu.EMO_WARNING
|
|
|
|
# place juste avant moy. gen.
|
|
|
|
table.insert_group("col_ues_validables", before="col_moy_gen")
|
|
|
|
classes = ["col_ue"]
|
|
|
|
if row.nb_ues_warning:
|
|
|
|
classes.append("moy_ue_warning")
|
|
|
|
elif row.nb_ues_validables < len(ues_sans_bonus):
|
|
|
|
classes.append("moy_inf")
|
|
|
|
row.add_cell(
|
|
|
|
"ues_validables",
|
|
|
|
"UEs",
|
|
|
|
ue_valid_txt_html,
|
2023-02-02 18:27:15 +01:00
|
|
|
group="col_ues_validables",
|
2023-01-29 21:52:39 +01:00
|
|
|
classes=classes,
|
|
|
|
raw_content=ue_valid_txt,
|
|
|
|
data={"order": row.nb_ues_validables}, # tri
|
|
|
|
)
|
|
|
|
|
|
|
|
if mode_jury and self.validations:
|
|
|
|
if self.is_apc:
|
|
|
|
# formations BUT: pas de code semestre, concatene ceux des UEs
|
|
|
|
dec_ues = self.validations.decisions_jury_ues.get(etud.id)
|
|
|
|
if dec_ues:
|
|
|
|
jury_code_sem = ",".join(
|
|
|
|
[dec_ues[ue_id].get("code", "") for ue_id in dec_ues]
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
jury_code_sem = ""
|
|
|
|
else:
|
|
|
|
# formations classiques: code semestre
|
|
|
|
dec_sem = self.validations.decisions_jury.get(etud.id)
|
|
|
|
jury_code_sem = dec_sem["code"] if dec_sem else ""
|
|
|
|
row.add_cell("jury_code_sem", "Jury", jury_code_sem, "jury_code_sem")
|
|
|
|
row.add_cell(
|
|
|
|
"jury_link",
|
|
|
|
"",
|
|
|
|
f"""<a href="{url_for('notes.formsemestre_validation_etud_form',
|
|
|
|
scodoc_dept=g.scodoc_dept, formsemestre_id=self.formsemestre.id, etudid=etud.id
|
|
|
|
)
|
|
|
|
}">{("saisir" if not jury_code_sem else "modifier")
|
|
|
|
if self.formsemestre.etat else "voir"} décisions</a>""",
|
|
|
|
"col_jury_link",
|
|
|
|
)
|
|
|
|
|
|
|
|
def _recap_add_ue(self, row: tb.Row, ue: UniteEns, ue_status: dict):
|
|
|
|
"Ajoute résultat UE au row (colonne col_ue)"
|
|
|
|
table = row.table
|
|
|
|
col_id = f"moy_ue_{ue.id}"
|
|
|
|
val = ue_status["moy"]
|
|
|
|
note_class = ""
|
|
|
|
if isinstance(val, float):
|
|
|
|
if val < table.barre_moy:
|
|
|
|
note_class = " moy_inf"
|
|
|
|
elif val >= table.barre_valid_ue:
|
|
|
|
note_class = " moy_ue_valid"
|
|
|
|
row.nb_ues_validables += 1
|
|
|
|
if val < table.barre_warning_ue:
|
|
|
|
note_class = " moy_ue_warning" # notes très basses
|
|
|
|
row.nb_ues_warning += 1
|
|
|
|
row.add_cell(
|
|
|
|
col_id,
|
|
|
|
ue.acronyme,
|
|
|
|
table.fmt_note(val),
|
|
|
|
group=f"col_ue_{ue.id}",
|
2023-02-02 18:27:15 +01:00
|
|
|
classes=["col_ue", "col_moy_ue", note_class],
|
2023-01-29 21:52:39 +01:00
|
|
|
)
|
|
|
|
row.table.foot_title_row.cells[col_id].target_attrs[
|
|
|
|
"title"
|
|
|
|
] = f"""{ue.titre} S{ue.semestre_idx or '?'}"""
|
|
|
|
|
|
|
|
def _recap_add_ue_modimpls(
|
|
|
|
self, row: tb.Row, ue: UniteEns, etud: Identite, is_capitalized: bool
|
|
|
|
):
|
|
|
|
"""Ajoute à row les moyennes des modules (ou ressources et SAÉs) dans l'UE"""
|
|
|
|
table = row.table
|
|
|
|
for modimpl in self.modimpls_in_ue(ue, etud.id, with_bonus=False):
|
|
|
|
if is_capitalized:
|
|
|
|
val = "-c-"
|
|
|
|
else:
|
|
|
|
modimpl_results = self.modimpls_results.get(modimpl.id)
|
|
|
|
if modimpl_results: # pas bonus
|
|
|
|
if self.is_apc: # BUT
|
|
|
|
moys_vers_ue = modimpl_results.etuds_moy_module.get(ue.id)
|
|
|
|
val = (
|
|
|
|
moys_vers_ue.get(etud.id, "?")
|
|
|
|
if moys_vers_ue is not None
|
|
|
|
else ""
|
|
|
|
)
|
|
|
|
else: # classique: Series indépendante de l'UE
|
|
|
|
val = modimpl_results.etuds_moy_module.get(etud.id, "?")
|
|
|
|
else:
|
|
|
|
val = ""
|
|
|
|
|
|
|
|
col_id = f"moy_{modimpl.module.type_abbrv()}_{modimpl.id}_{ue.id}"
|
2023-02-02 19:22:29 +01:00
|
|
|
|
|
|
|
val_fmt_html = val_fmt = table.fmt_note(val)
|
2023-01-29 21:52:39 +01:00
|
|
|
if modimpl.module.module_type == scu.ModuleType.MALUS:
|
2023-02-02 19:22:29 +01:00
|
|
|
if val and not isinstance(val, str) and not np.isnan(val):
|
|
|
|
if val >= 0:
|
|
|
|
val_fmt_html = f"""<span class="red-arrow-down"></span><span class="sp2l">+{
|
|
|
|
val_fmt
|
|
|
|
}</span>"""
|
|
|
|
else:
|
|
|
|
# val_fmt_html = (scu.EMO_RED_TRIANGLE_DOWN + val_fmt)
|
|
|
|
val_fmt_html = f"""<span class="green-arrow-up"></span><span class="sp2l malus_negatif">-{
|
|
|
|
table.fmt_note(-val)
|
|
|
|
}</span>"""
|
|
|
|
else:
|
|
|
|
val_fmt = val_fmt_html = "" # inscrit à ce malus, mais sans note
|
|
|
|
|
2023-01-29 21:52:39 +01:00
|
|
|
cell = row.add_cell(
|
|
|
|
col_id,
|
|
|
|
modimpl.module.code,
|
|
|
|
val_fmt_html,
|
|
|
|
raw_content=val_fmt,
|
|
|
|
group=f"col_ue_{ue.id}_modules",
|
|
|
|
classes=[
|
|
|
|
f"col_{modimpl.module.type_abbrv()}",
|
|
|
|
f"mod_ue_{ue.id}",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
if modimpl.module.module_type == scu.ModuleType.MALUS:
|
|
|
|
# positionne la colonne à droite de l'UE
|
|
|
|
cell.group = f"col_ue_{ue.id}_malus"
|
|
|
|
table.insert_group(cell.group, after=f"col_ue_{ue.id}")
|
|
|
|
|
|
|
|
table.foot_title_row.cells[col_id].target = url_for(
|
|
|
|
"notes.moduleimpl_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
moduleimpl_id=modimpl.id,
|
|
|
|
)
|
|
|
|
|
|
|
|
nom_resp = table.cache_nomcomplet.get(modimpl.responsable_id)
|
|
|
|
if nom_resp is None:
|
|
|
|
user = User.query.get(modimpl.responsable_id)
|
|
|
|
nom_resp = user.get_nomcomplet() if user else ""
|
|
|
|
table.cache_nomcomplet[modimpl.responsable_id] = nom_resp
|
|
|
|
table.foot_title_row.cells[col_id].target_attrs[
|
|
|
|
"title"
|
|
|
|
] = f"{modimpl.module.titre} ({nom_resp})"
|
|
|
|
table.modimpl_ue_ids.add((modimpl.id, ue.id))
|
|
|
|
|
|
|
|
def _recap_add_bottom_rows(self, table: tb.Table, ues):
|
2023-01-14 21:56:41 +01:00
|
|
|
"""Les informations à mettre en bas de la table: min, max, moy, ECTS, Apo"""
|
2023-01-22 20:39:46 +01:00
|
|
|
# Ordre des lignes: Min, Max, Moy, Coef, ECTS, Apo
|
|
|
|
row_min = tb.BottomRow(
|
|
|
|
table,
|
|
|
|
"min",
|
2023-01-29 21:52:39 +01:00
|
|
|
left_title="Min.",
|
2023-01-22 20:39:46 +01:00
|
|
|
left_title_col_ids=["prenom", "nom_short"],
|
|
|
|
category="bottom_infos",
|
|
|
|
classes=["bottom_info"],
|
|
|
|
)
|
|
|
|
row_max = tb.BottomRow(
|
|
|
|
table,
|
|
|
|
"max",
|
2023-01-29 21:52:39 +01:00
|
|
|
left_title="Max.",
|
2023-01-22 20:39:46 +01:00
|
|
|
left_title_col_ids=["prenom", "nom_short"],
|
|
|
|
category="bottom_infos",
|
|
|
|
classes=["bottom_info"],
|
|
|
|
)
|
|
|
|
row_moy = tb.BottomRow(
|
|
|
|
table,
|
|
|
|
"moy",
|
2023-01-29 21:52:39 +01:00
|
|
|
left_title="Moy.",
|
2023-01-22 20:39:46 +01:00
|
|
|
left_title_col_ids=["prenom", "nom_short"],
|
|
|
|
category="bottom_infos",
|
|
|
|
classes=["bottom_info"],
|
|
|
|
)
|
|
|
|
row_coef = tb.BottomRow(
|
|
|
|
table,
|
|
|
|
"coef",
|
2023-01-29 21:52:39 +01:00
|
|
|
left_title="Coef.",
|
2023-01-22 20:39:46 +01:00
|
|
|
left_title_col_ids=["prenom", "nom_short"],
|
|
|
|
category="bottom_infos",
|
|
|
|
classes=["bottom_info"],
|
|
|
|
)
|
|
|
|
row_ects = tb.BottomRow(
|
|
|
|
table,
|
|
|
|
"ects",
|
2023-01-29 21:52:39 +01:00
|
|
|
left_title="ECTS",
|
2023-01-22 20:39:46 +01:00
|
|
|
left_title_col_ids=["prenom", "nom_short"],
|
|
|
|
category="bottom_infos",
|
|
|
|
classes=["bottom_info"],
|
2022-03-28 18:13:51 +02:00
|
|
|
)
|
2023-01-22 20:39:46 +01:00
|
|
|
row_apo = tb.BottomRow(
|
|
|
|
table,
|
|
|
|
"apo",
|
2023-01-29 21:52:39 +01:00
|
|
|
left_title="Code Apogée",
|
2023-01-22 20:39:46 +01:00
|
|
|
left_title_col_ids=["prenom", "nom_short"],
|
|
|
|
category="bottom_infos",
|
|
|
|
classes=["bottom_info"],
|
|
|
|
)
|
|
|
|
|
2022-03-27 22:25:00 +02:00
|
|
|
# --- ECTS
|
2023-01-22 20:39:46 +01:00
|
|
|
# titre (à gauche) sur 2 colonnes pour s'adapter à l'affichage des noms/prenoms
|
2022-03-27 22:25:00 +02:00
|
|
|
for ue in ues:
|
2023-01-22 20:39:46 +01:00
|
|
|
col_id = f"moy_ue_{ue.id}"
|
2023-01-29 21:52:39 +01:00
|
|
|
row_ects.add_cell(col_id, None, ue.ects)
|
2023-01-22 20:39:46 +01:00
|
|
|
# ajoute cell UE vides sur ligne coef pour borders verticales
|
|
|
|
# XXX TODO classes dans table sur colonne ajoutées à tous les TD
|
2023-01-29 21:52:39 +01:00
|
|
|
row_coef.add_cell(col_id, None, "")
|
2023-01-22 20:39:46 +01:00
|
|
|
row_ects.add_cell(
|
|
|
|
"moy_gen",
|
|
|
|
None,
|
|
|
|
sum([ue.ects or 0 for ue in ues if ue.type != UE_SPORT]),
|
|
|
|
)
|
2022-04-04 09:35:52 +02:00
|
|
|
# --- MIN, MAX, MOY, APO
|
2023-01-29 21:52:39 +01:00
|
|
|
row_min.add_cell("moy_gen", None, table.fmt_note(self.etud_moy_gen.min()))
|
|
|
|
row_max.add_cell("moy_gen", None, table.fmt_note(self.etud_moy_gen.max()))
|
|
|
|
row_moy.add_cell("moy_gen", None, table.fmt_note(self.etud_moy_gen.mean()))
|
2022-03-28 18:13:51 +02:00
|
|
|
|
|
|
|
for ue in ues:
|
2023-01-22 20:39:46 +01:00
|
|
|
col_id = f"moy_ue_{ue.id}"
|
2023-01-29 21:52:39 +01:00
|
|
|
row_min.add_cell(
|
|
|
|
col_id, None, table.fmt_note(self.etud_moy_ue[ue.id].min())
|
|
|
|
)
|
|
|
|
row_max.add_cell(
|
|
|
|
col_id, None, table.fmt_note(self.etud_moy_ue[ue.id].max())
|
|
|
|
)
|
|
|
|
row_moy.add_cell(
|
|
|
|
col_id, None, table.fmt_note(self.etud_moy_ue[ue.id].mean())
|
|
|
|
)
|
2023-01-22 20:39:46 +01:00
|
|
|
row_apo.add_cell(col_id, None, ue.code_apogee or "")
|
2022-03-27 22:25:00 +02:00
|
|
|
|
|
|
|
for modimpl in self.formsemestre.modimpls_sorted:
|
2023-01-29 21:52:39 +01:00
|
|
|
if (modimpl.id, ue.id) in table.modimpl_ue_ids:
|
2023-01-22 20:39:46 +01:00
|
|
|
col_id = f"moy_{modimpl.module.type_abbrv()}_{modimpl.id}_{ue.id}"
|
2022-03-27 22:25:00 +02:00
|
|
|
if self.is_apc:
|
2022-03-28 09:50:40 +02:00
|
|
|
coef = self.modimpl_coefs_df[modimpl.id][ue.id]
|
2022-03-27 22:25:00 +02:00
|
|
|
else:
|
|
|
|
coef = modimpl.module.coefficient or 0
|
2023-01-29 21:52:39 +01:00
|
|
|
row_coef.add_cell(
|
|
|
|
col_id,
|
|
|
|
None,
|
|
|
|
table.fmt_note(coef),
|
|
|
|
group=f"col_ue_{ue.id}_modules",
|
|
|
|
)
|
2022-03-27 22:25:00 +02:00
|
|
|
notes = self.modimpl_notes(modimpl.id, ue.id)
|
2022-08-03 20:43:07 +02:00
|
|
|
if np.isnan(notes).all():
|
|
|
|
# aucune note valide
|
2023-01-22 20:39:46 +01:00
|
|
|
row_min.add_cell(col_id, None, np.nan)
|
|
|
|
row_max.add_cell(col_id, None, np.nan)
|
2022-08-03 20:43:07 +02:00
|
|
|
moy = np.nan
|
|
|
|
else:
|
2023-01-29 21:52:39 +01:00
|
|
|
row_min.add_cell(col_id, None, table.fmt_note(np.nanmin(notes)))
|
|
|
|
row_max.add_cell(col_id, None, table.fmt_note(np.nanmax(notes)))
|
2022-08-03 20:43:07 +02:00
|
|
|
moy = np.nanmean(notes)
|
2023-01-22 20:39:46 +01:00
|
|
|
row_moy.add_cell(
|
|
|
|
col_id,
|
|
|
|
None,
|
2023-01-29 21:52:39 +01:00
|
|
|
table.fmt_note(moy),
|
2023-01-22 20:39:46 +01:00
|
|
|
# aucune note dans ce module ?
|
|
|
|
classes=["col_empty" if np.isnan(moy) else ""],
|
|
|
|
)
|
|
|
|
row_apo.add_cell(col_id, None, modimpl.module.code_apogee or "")
|
2022-03-27 22:25:00 +02:00
|
|
|
|
2022-06-23 10:13:18 +02:00
|
|
|
def _recap_etud_groups_infos(
|
|
|
|
self, etudid: int, row: dict, titles: dict
|
|
|
|
): # XXX non utilisé
|
2022-03-27 22:25:00 +02:00
|
|
|
"""Table recap: ajoute à row les colonnes sur les groupes pour cet etud"""
|
|
|
|
# dec = self.get_etud_decision_sem(etudid)
|
|
|
|
# if dec:
|
|
|
|
# codes_nb[dec["code"]] += 1
|
|
|
|
row_class = ""
|
2022-04-02 13:30:26 +02:00
|
|
|
etud_etat = self.get_etud_etat(etudid)
|
2022-03-27 22:25:00 +02:00
|
|
|
if etud_etat == DEM:
|
|
|
|
gr_name = "Dém."
|
|
|
|
row_class = "dem"
|
|
|
|
elif etud_etat == DEF:
|
|
|
|
gr_name = "Déf."
|
|
|
|
row_class = "def"
|
|
|
|
else:
|
|
|
|
# XXX probablement à revoir pour utiliser données cachées,
|
|
|
|
# via get_etud_groups_in_partition ou autre
|
|
|
|
group = sco_groups.get_etud_main_group(etudid, self.formsemestre.id)
|
|
|
|
gr_name = group["group_name"] or ""
|
|
|
|
row["group"] = gr_name
|
|
|
|
row["_group_class"] = "group"
|
|
|
|
if row_class:
|
|
|
|
row["_tr_class"] = " ".join([row.get("_tr_class", ""), row_class])
|
|
|
|
titles["group"] = "Gr"
|
2022-03-29 00:03:38 +02:00
|
|
|
|
2023-01-22 20:39:46 +01:00
|
|
|
def _recap_add_admissions(self, table: tb.Table):
|
2022-03-29 00:03:38 +02:00
|
|
|
"""Ajoute les colonnes "admission"
|
|
|
|
Les colonnes ont la classe css "admission"
|
|
|
|
"""
|
|
|
|
fields = {
|
|
|
|
"bac": "Bac",
|
|
|
|
"specialite": "Spécialité",
|
|
|
|
"type_admission": "Type Adm.",
|
|
|
|
"classement": "Rg. Adm.",
|
|
|
|
}
|
2022-04-03 16:20:16 +02:00
|
|
|
first = True
|
2023-01-22 20:39:46 +01:00
|
|
|
for cid, title in fields.items():
|
|
|
|
cell_head, cell_foot = table.add_title(cid, title)
|
|
|
|
cell_head.classes.append("admission")
|
|
|
|
cell_foot.classes.append("admission")
|
2022-04-03 16:20:16 +02:00
|
|
|
if first:
|
2023-01-22 20:39:46 +01:00
|
|
|
cell_head.classes.append("admission_first")
|
|
|
|
cell_foot.classes.append("admission_first")
|
2022-04-03 16:20:16 +02:00
|
|
|
first = False
|
2023-01-22 20:39:46 +01:00
|
|
|
|
|
|
|
for row in table.rows:
|
|
|
|
etud = Identite.query.get(row.id) # TODO XXX
|
2022-03-29 00:03:38 +02:00
|
|
|
admission = etud.admission.first()
|
|
|
|
first = True
|
2023-01-22 20:39:46 +01:00
|
|
|
for cid, title in fields.items():
|
|
|
|
cell = row.add_cell(
|
|
|
|
cid,
|
|
|
|
title,
|
|
|
|
getattr(admission, cid) or "",
|
|
|
|
"admission",
|
|
|
|
)
|
2022-03-29 00:03:38 +02:00
|
|
|
if first:
|
2023-01-22 20:39:46 +01:00
|
|
|
cell.classes.append("admission_first")
|
2022-03-29 00:03:38 +02:00
|
|
|
first = False
|
|
|
|
|
2023-01-22 20:39:46 +01:00
|
|
|
def recap_add_cursus(self, table: tb.Table):
|
2022-12-25 14:47:58 +01:00
|
|
|
"""Ajoute colonne avec code cursus, eg 'S1 S2 S1'"""
|
2023-01-22 20:39:46 +01:00
|
|
|
table.insert_group("cursus", before="col_ues_validables")
|
2022-12-25 14:47:58 +01:00
|
|
|
cid = "code_cursus"
|
|
|
|
formation_code = self.formsemestre.formation.formation_code
|
2023-01-22 20:39:46 +01:00
|
|
|
for row in table.rows:
|
|
|
|
etud = Identite.query.get(row.id) # TODO XXX à optimiser: etud dans row
|
|
|
|
row.add_cell(
|
|
|
|
cid,
|
|
|
|
"Cursus",
|
|
|
|
" ".join(
|
|
|
|
[
|
|
|
|
f"S{ins.formsemestre.semestre_id}"
|
|
|
|
for ins in reversed(etud.inscriptions())
|
|
|
|
if ins.formsemestre.formation.formation_code == formation_code
|
|
|
|
]
|
|
|
|
),
|
|
|
|
"cursus",
|
2022-12-25 14:47:58 +01:00
|
|
|
)
|
|
|
|
|
2023-01-22 20:39:46 +01:00
|
|
|
def recap_add_partitions(self, table: tb.Table):
|
2022-03-29 00:03:38 +02:00
|
|
|
"""Ajoute les colonnes indiquant les groupes
|
2023-01-22 20:39:46 +01:00
|
|
|
La table contient des rows avec la clé etudid.
|
|
|
|
|
2022-03-29 00:03:38 +02:00
|
|
|
Les colonnes ont la classe css "partition"
|
|
|
|
"""
|
2023-01-29 21:52:39 +01:00
|
|
|
table.insert_group("partition", after="identite_court")
|
2022-03-29 00:03:38 +02:00
|
|
|
partitions, partitions_etud_groups = sco_groups.get_formsemestre_groups(
|
|
|
|
self.formsemestre.id
|
|
|
|
)
|
|
|
|
first_partition = True
|
|
|
|
for partition in partitions:
|
|
|
|
cid = f"part_{partition['partition_id']}"
|
2023-01-22 20:39:46 +01:00
|
|
|
|
2022-03-29 00:03:38 +02:00
|
|
|
partition_etud_groups = partitions_etud_groups[partition["partition_id"]]
|
2023-01-22 20:39:46 +01:00
|
|
|
for row in table.rows:
|
2023-01-29 21:52:39 +01:00
|
|
|
etudid = row.id
|
2022-05-23 10:59:43 +02:00
|
|
|
group = None # group (dict) de l'étudiant dans cette partition
|
2022-03-29 00:03:38 +02:00
|
|
|
# dans NotesTableCompat, à revoir
|
2023-01-22 20:39:46 +01:00
|
|
|
etud_etat = self.get_etud_etat(row.id) # row.id == etudid
|
|
|
|
tr_classes = []
|
2022-09-30 22:43:39 +02:00
|
|
|
if etud_etat == scu.DEMISSION:
|
2022-03-29 00:03:38 +02:00
|
|
|
gr_name = "Dém."
|
2023-01-22 20:39:46 +01:00
|
|
|
tr_classes.append("dem")
|
2022-03-29 00:03:38 +02:00
|
|
|
elif etud_etat == DEF:
|
|
|
|
gr_name = "Déf."
|
2023-01-22 20:39:46 +01:00
|
|
|
tr_classes.append("def")
|
2022-03-29 00:03:38 +02:00
|
|
|
else:
|
2023-01-29 21:52:39 +01:00
|
|
|
group = partition_etud_groups.get(etudid)
|
2022-03-29 00:03:38 +02:00
|
|
|
gr_name = group["group_name"] if group else ""
|
|
|
|
if gr_name:
|
2023-01-22 20:39:46 +01:00
|
|
|
row.add_cell(
|
|
|
|
cid,
|
|
|
|
partition["partition_name"],
|
|
|
|
gr_name,
|
2023-02-02 18:27:15 +01:00
|
|
|
group="partition",
|
|
|
|
classes=[] if first_partition else ["partition_aux"],
|
|
|
|
# la classe "partition" est ajoutée par la Table car c'est le group
|
|
|
|
# la classe "partition_aux" est ajoutée à partir de la 2eme partition affichée
|
2023-01-22 20:39:46 +01:00
|
|
|
)
|
2023-02-02 18:27:15 +01:00
|
|
|
first_partition = False
|
2023-01-22 20:39:46 +01:00
|
|
|
|
2022-05-23 10:59:43 +02:00
|
|
|
# Rangs dans groupe
|
|
|
|
if (
|
|
|
|
partition["bul_show_rank"]
|
|
|
|
and (group is not None)
|
|
|
|
and (group["id"] in self.moy_gen_rangs_by_group)
|
|
|
|
):
|
|
|
|
rang = self.moy_gen_rangs_by_group[group["id"]][0]
|
2023-02-02 18:27:15 +01:00
|
|
|
rg_cid = cid + "_rg" # rang dans la partition
|
|
|
|
row.add_cell(
|
|
|
|
rg_cid,
|
|
|
|
f"Rg {partition['partition_name']}",
|
|
|
|
rang.get(etudid, ""),
|
|
|
|
group="partition",
|
|
|
|
classes=["partition_aux"],
|
|
|
|
)
|
2022-04-04 09:35:52 +02:00
|
|
|
|
2023-01-22 20:39:46 +01:00
|
|
|
def _recap_add_evaluations(self, table: tb.Table):
|
2022-04-04 09:35:52 +02:00
|
|
|
"""Ajoute les colonnes avec les notes aux évaluations
|
|
|
|
rows est une liste de dict avec une clé "etudid"
|
|
|
|
Les colonnes ont la classe css "evaluation"
|
|
|
|
"""
|
|
|
|
# nouvelle ligne pour description évaluations:
|
2023-01-22 20:39:46 +01:00
|
|
|
row_descr_eval = tb.BottomRow(
|
|
|
|
table,
|
|
|
|
"evaluations",
|
2023-01-29 21:52:39 +01:00
|
|
|
left_title="Description évaluations",
|
2023-01-22 20:39:46 +01:00
|
|
|
left_title_col_ids=["prenom", "nom_short"],
|
|
|
|
category="bottom_infos",
|
|
|
|
classes=["bottom_info"],
|
|
|
|
)
|
|
|
|
|
2022-04-10 17:38:59 +02:00
|
|
|
first_eval = True
|
2022-04-04 09:35:52 +02:00
|
|
|
for modimpl in self.formsemestre.modimpls_sorted:
|
|
|
|
evals = self.modimpls_results[modimpl.id].get_evaluations_completes(modimpl)
|
|
|
|
eval_index = len(evals) - 1
|
|
|
|
inscrits = {i.etudid for i in modimpl.inscriptions}
|
2022-04-10 17:38:59 +02:00
|
|
|
first_eval_of_mod = True
|
|
|
|
for e in evals:
|
2023-01-22 20:39:46 +01:00
|
|
|
col_id = f"eval_{e.id}"
|
|
|
|
title = f'{modimpl.module.code} {eval_index} {e.jour.isoformat() if e.jour else ""}'
|
|
|
|
col_classes = ["evaluation"]
|
2022-04-10 17:38:59 +02:00
|
|
|
if first_eval:
|
2023-01-22 20:39:46 +01:00
|
|
|
col_classes.append("first")
|
2022-04-10 17:38:59 +02:00
|
|
|
elif first_eval_of_mod:
|
2023-01-22 20:39:46 +01:00
|
|
|
col_classes.append("first_of_mod")
|
2022-04-10 17:38:59 +02:00
|
|
|
first_eval_of_mod = first_eval = False
|
2022-04-04 09:35:52 +02:00
|
|
|
eval_index -= 1
|
|
|
|
notes_db = sco_evaluation_db.do_evaluation_get_all_notes(
|
|
|
|
e.evaluation_id
|
|
|
|
)
|
2023-01-22 20:39:46 +01:00
|
|
|
for row in table.rows:
|
|
|
|
etudid = row.id
|
2022-04-04 09:35:52 +02:00
|
|
|
if etudid in inscrits:
|
|
|
|
if etudid in notes_db:
|
|
|
|
val = notes_db[etudid]["value"]
|
|
|
|
else:
|
|
|
|
# Note manquante mais prise en compte immédiate: affiche ATT
|
|
|
|
val = scu.NOTES_ATTENTE
|
2023-01-29 21:52:39 +01:00
|
|
|
content = table.fmt_note(val)
|
2023-01-22 20:39:46 +01:00
|
|
|
classes = col_classes + [
|
|
|
|
{
|
|
|
|
"ABS": "abs",
|
|
|
|
"ATT": "att",
|
|
|
|
"EXC": "exc",
|
|
|
|
}.get(content, "")
|
|
|
|
]
|
|
|
|
row.add_cell(col_id, title, content, "", classes=classes)
|
2022-04-10 17:38:59 +02:00
|
|
|
else:
|
2023-01-22 20:39:46 +01:00
|
|
|
row.add_cell(
|
|
|
|
col_id,
|
|
|
|
title,
|
|
|
|
"ni",
|
|
|
|
"",
|
|
|
|
classes=col_classes + ["non_inscrit"],
|
|
|
|
)
|
|
|
|
|
|
|
|
table.get_row_by_id("coef").row[col_id] = e.coefficient
|
|
|
|
table.get_row_by_id("min").row[col_id] = "0"
|
2023-01-29 21:52:39 +01:00
|
|
|
table.get_row_by_id("max").row[col_id] = table.fmt_note(e.note_max)
|
2023-01-22 20:39:46 +01:00
|
|
|
row_descr_eval.add_cell(
|
|
|
|
col_id,
|
|
|
|
None,
|
|
|
|
e.description or "",
|
|
|
|
target=url_for(
|
|
|
|
"notes.evaluation_listenotes",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
evaluation_id=e.id,
|
|
|
|
),
|
2022-04-09 14:20:56 +02:00
|
|
|
)
|