1
0
forked from ScoDoc/ScoDoc

Fix evaluation_listenotes (groupes)

This commit is contained in:
Emmanuel Viennet 2024-09-23 15:32:57 +02:00
parent b6211c80a6
commit 0d5d6e7e3b
2 changed files with 14 additions and 14 deletions

View File

@ -125,7 +125,7 @@ class Partition(ScoDocModel):
} }
return d return d
def get_etud_group(self, etudid: int) -> "GroupDescr": def get_etud_group(self, etudid: int) -> "GroupDescr|None":
"Le groupe de l'étudiant dans cette partition, ou None si pas présent" "Le groupe de l'étudiant dans cette partition, ou None si pas présent"
return ( return (
GroupDescr.query.filter_by(partition_id=self.id) GroupDescr.query.filter_by(partition_id=self.id)

View File

@ -39,10 +39,8 @@ from app.comp import moy_mod
from app.comp.moy_mod import ModuleImplResults from app.comp.moy_mod import ModuleImplResults
from app.comp.res_but import ResultatsSemestreBUT from app.comp.res_but import ResultatsSemestreBUT
from app.comp.res_compat import NotesTableCompat from app.comp.res_compat import NotesTableCompat
from app.models import FormSemestre, Module from app.models import Evaluation, FormSemestre, Identite, Module, ModuleImpl, Partition
from app.models.etudiants import Identite
from app.models.evaluations import Evaluation
from app.models.moduleimpls import ModuleImpl
from app.scodoc import ( from app.scodoc import (
sco_evaluations, sco_evaluations,
sco_evaluation_db, sco_evaluation_db,
@ -258,10 +256,8 @@ def _make_table_notes(
if e.moduleimpl_id != modimpl.id: if e.moduleimpl_id != modimpl.id:
raise ValueError("invalid evaluations list") raise ValueError("invalid evaluations list")
if fmt == "xls" or fmt == "json": # pas de conversion des notes en strings pour certains formats:
keep_numeric = True # pas de conversion des notes en strings keep_numeric = fmt in ("xls", "json")
else:
keep_numeric = False
# Menu groupes # Menu groupes
group_selector = ( group_selector = (
sco_groups_view.form_groups_choice( sco_groups_view.form_groups_choice(
@ -287,7 +283,8 @@ def _make_table_notes(
columns_ids = ["etudid", "nom", "prenom"] columns_ids = ["etudid", "nom", "prenom"]
else: else:
columns_ids = ["nomprenom"] columns_ids = ["nomprenom"]
partitions = []
partitions: list[Partition] = []
if not args["hide_groups"]: if not args["hide_groups"]:
if args["split_groups"]: if args["split_groups"]:
partitions = formsemestre.get_partitions_list( partitions = formsemestre.get_partitions_list(
@ -350,10 +347,13 @@ def _make_table_notes(
if etat == scu.INSCRIT: # si inscrit, indique groupe if etat == scu.INSCRIT: # si inscrit, indique groupe
groups = sco_groups.get_etud_groups(etudid, formsemestre.id) groups = sco_groups.get_etud_groups(etudid, formsemestre.id)
grc = sco_groups.listgroups_abbrev(groups) grc = sco_groups.listgroups_abbrev(groups)
groups_cols = { groups_cols = {}
f"partition_{p.id}": p.get_etud_group(etudid).group_name or "" for p in partitions:
for p in partitions etud_group = p.get_etud_group(etudid)
} groups_cols[f"partition_{p.id}"] = (
(etud_group.group_name or "") if etud_group else ""
)
else: else:
if etat == scu.DEMISSION: if etat == scu.DEMISSION:
grc = "DEM" # attention: ce code est re-ecrit plus bas, ne pas le changer (?) grc = "DEM" # attention: ce code est re-ecrit plus bas, ne pas le changer (?)