diff --git a/app/but/bulletin_but.py b/app/but/bulletin_but.py
index 506f8754e..af33fac9c 100644
--- a/app/but/bulletin_but.py
+++ b/app/but/bulletin_but.py
@@ -13,7 +13,7 @@ import numpy as np
from flask import g, has_request_context, url_for
from app.comp.res_but import ResultatsSemestreBUT
-from app.models import FormSemestre, Identite
+from app.models import Evaluation, FormSemestre, Identite
from app.models.groups import GroupDescr
from app.models.ues import UniteEns
from app.scodoc import sco_bulletins, sco_utils as scu
@@ -249,7 +249,7 @@ class BulletinBUT:
}
return d
- def etud_eval_results(self, etud, e) -> dict:
+ def etud_eval_results(self, etud, e: Evaluation) -> dict:
"dict resultats d'un étudiant à une évaluation"
# eval_notes est une pd.Series avec toutes les notes des étudiants inscrits
eval_notes = self.res.modimpls_results[e.moduleimpl_id].evals_notes[e.id]
@@ -265,12 +265,14 @@ class BulletinBUT:
poids = collections.defaultdict(lambda: 0.0)
d = {
"id": e.id,
- "description": e.description,
+ "coef": fmt_note(e.coefficient)
+ if e.evaluation_type == scu.EVALUATION_NORMALE
+ else None,
"date": e.jour.isoformat() if e.jour else None,
+ "description": e.description,
+ "evaluation_type": e.evaluation_type,
"heure_debut": e.heure_debut.strftime("%H:%M") if e.heure_debut else None,
"heure_fin": e.heure_fin.strftime("%H:%M") if e.heure_debut else None,
- "coef": fmt_note(e.coefficient),
- "poids": poids,
"note": {
"value": fmt_note(
eval_notes[etud.id],
@@ -280,6 +282,7 @@ class BulletinBUT:
"max": fmt_note(notes_ok.max()),
"moy": fmt_note(notes_ok.mean()),
},
+ "poids": poids,
"url": url_for(
"notes.evaluation_listenotes",
scodoc_dept=g.scodoc_dept,
diff --git a/app/but/bulletin_but_pdf.py b/app/but/bulletin_but_pdf.py
index e3e40c51f..3954c818f 100644
--- a/app/but/bulletin_but_pdf.py
+++ b/app/but/bulletin_but_pdf.py
@@ -13,6 +13,7 @@ from reportlab.platypus import Paragraph, Spacer
from app.scodoc.sco_bulletins_standard import BulletinGeneratorStandard
from app.scodoc import gen_tables
from app.scodoc.sco_codes_parcours import UE_SPORT
+from app.scodoc import sco_utils as scu
class BulletinGeneratorStandardBUT(BulletinGeneratorStandard):
@@ -312,18 +313,19 @@ class BulletinGeneratorStandardBUT(BulletinGeneratorStandard):
]
return col_keys, rows, pdf_style, col_widths
- def evaluations_rows(self, rows, evaluations, ue_acros=()):
+ def evaluations_rows(self, rows, evaluations: list[dict], ue_acros=()):
"lignes des évaluations"
for e in evaluations:
+ coef = e["coef"] if e["evaluation_type"] == scu.EVALUATION_NORMALE else "*"
t = {
"titre": f"{e['description'] or ''}",
"moyenne": e["note"]["value"],
"_moyenne_pdf": Paragraph(
f"""
Si le problème persiste, merci de contacter l'assistance via la liste de diffusion Notes - ou le salon Discord. + ou de préférence le salon Discord.
Message serveur: {msg}
""" diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index cfe24135a..897482505 100644 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -40,12 +40,14 @@ from app.comp import res_sem from app.comp.res_compat import NotesTableCompat from app.models import Module from app.models.formsemestre import FormSemestre -from app.models.moduleimpls import ModuleImpl import app.scodoc.sco_utils as scu from app.scodoc.sco_utils import ModuleType -import app.scodoc.notesdb as ndb from app.scodoc.sco_permissions import Permission -from app.scodoc.sco_exceptions import ScoValueError, ScoInvalidDateError +from app.scodoc.sco_exceptions import ( + ScoValueError, + ScoInvalidDateError, + ScoInvalidIdType, +) from app.scodoc import html_sco_header from app.scodoc import htmlutils from app.scodoc import sco_abs @@ -58,7 +60,6 @@ from app.scodoc import sco_evaluations from app.scodoc import sco_evaluation_db from app.scodoc import sco_formations from app.scodoc import sco_formsemestre -from app.scodoc import sco_formsemestre_edit from app.scodoc import sco_formsemestre_inscriptions from app.scodoc import sco_groups from app.scodoc import sco_moduleimpl @@ -1008,6 +1009,10 @@ Il y a des notes en attente ! Le classement des étudiants n'a qu'une valeur ind def formsemestre_status(formsemestre_id=None): """Tableau de bord semestre HTML""" # porté du DTML + if formsemestre_id is not None and not isinstance(formsemestre_id, int): + raise ScoInvalidIdType( + "formsemestre_bulletinetud: formsemestre_id must be an integer !" + ) formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id) modimpls = sco_moduleimpl.moduleimpl_withmodule_list( formsemestre_id=formsemestre_id diff --git a/app/scodoc/sco_import_etuds.py b/app/scodoc/sco_import_etuds.py index 629dec355..53b4563d8 100644 --- a/app/scodoc/sco_import_etuds.py +++ b/app/scodoc/sco_import_etuds.py @@ -740,7 +740,8 @@ def scolars_import_admission(datafile, formsemestre_id=None, type_admission=None _ADM_PATTERN = re.compile(r"[\W]+", re.UNICODE) # supprime tout sauf alphanum -def adm_normalize_string(s): # normalize unicode title +def adm_normalize_string(s): + "normalize unicode title" return scu.suppress_accents(_ADM_PATTERN.sub("", s.strip().lower())).replace( "_", "" ) @@ -750,16 +751,15 @@ def adm_get_fields(titles, formsemestre_id): """Cherche les colonnes importables dans les titres (ligne 1) du fichier excel return: { idx : (field_name, convertor) } """ - # log('adm_get_fields: titles=%s' % titles) - Fmt = sco_import_format_dict() + format_dict = sco_import_format_dict() fields = {} idx = 0 for title in titles: title_n = adm_normalize_string(title) - for k in Fmt: - for v in Fmt[k]["aliases"]: + for k in format_dict: + for v in format_dict[k]["aliases"]: if adm_normalize_string(v) == title_n: - typ = Fmt[k]["type"] + typ = format_dict[k]["type"] if typ == "real": convertor = adm_convert_real elif typ == "integer" or typ == "int": @@ -769,10 +769,9 @@ def adm_get_fields(titles, formsemestre_id): # doublons ? if k in [x[0] for x in fields.values()]: raise ScoFormatError( - 'scolars_import_admission: titre "%s" en double (ligne 1)' - % (title), + f"""scolars_import_admission: titre "{title}" en double (ligne 1)""", dest_url=url_for( - "scolar.form_students_import_infos_admissions_apb", + "scolar.form_students_import_infos_admissions", scodoc_dept=g.scodoc_dept, formsemestre_id=formsemestre_id, ), diff --git a/app/static/js/releve-but.js b/app/static/js/releve-but.js index a84e0dac4..3b4213380 100644 --- a/app/static/js/releve-but.js +++ b/app/static/js/releve-but.js @@ -399,7 +399,7 @@ class releveBUT extends HTMLElement {