diff --git a/app/models/etudiants.py b/app/models/etudiants.py index 3aacb66a9f..b1fec6092f 100644 --- a/app/models/etudiants.py +++ b/app/models/etudiants.py @@ -302,22 +302,46 @@ class Identite(db.Model): else: date_ins = events[0].event_date situation += date_ins.strftime(" le %d/%m/%Y") + elif inscr.etat == scu.DEF: + situation = f"défaillant en {inscr.formsemestre.titre_mois()}" + event = ( + models.ScolarEvent.query.filter_by( + etudid=self.id, + formsemestre_id=inscr.formsemestre.id, + event_type="DEFAILLANCE", + ) + .order_by(models.ScolarEvent.event_date) + .first() + ) + if not event: + log( + f"*** situation inconsistante pour {self} (def mais pas d'event)" + ) + situation += "???" # ??? + else: + date_def = event.event_date + situation += date_def.strftime(" le %d/%m/%Y") + else: situation = f"démission de {inscr.formsemestre.titre_mois()}" # Cherche la date de demission dans scolar_events: - events = models.ScolarEvent.query.filter_by( - etudid=self.id, - formsemestre_id=inscr.formsemestre.id, - event_type="DEMISSION", - ).all() - if not events: + event = ( + models.ScolarEvent.query.filter_by( + etudid=self.id, + formsemestre_id=inscr.formsemestre.id, + event_type="DEMISSION", + ) + .order_by(models.ScolarEvent.event_date) + .first() + ) + if not event: log( f"*** situation inconsistante pour {self} (demission mais pas d'event)" ) - date_dem = "???" # ??? + situation += "???" # ??? else: - date_dem = events[0].event_date - situation += date_dem.strftime(" le %d/%m/%Y") + date_dem = event.event_date + situation += date_dem.strftime(" le %d/%m/%Y") else: situation = "non inscrit" + self.e diff --git a/app/scodoc/sco_formsemestre.py b/app/scodoc/sco_formsemestre.py index 98fc64a2a3..11792057cd 100644 --- a/app/scodoc/sco_formsemestre.py +++ b/app/scodoc/sco_formsemestre.py @@ -95,9 +95,12 @@ _formsemestreEditor = ndb.EditableTable( def get_formsemestre(formsemestre_id, raise_soft_exc=False): "list ONE formsemestre" + if formsemestre_id is None: + raise ValueError(f"get_formsemestre: id manquant") if formsemestre_id in g.stored_get_formsemestre: return g.stored_get_formsemestre[formsemestre_id] if not isinstance(formsemestre_id, int): + log(f"get_formsemestre: invalid id '{formsemestre_id}'") raise ScoInvalidIdType("formsemestre_id must be an integer !") sems = do_formsemestre_list(args={"formsemestre_id": formsemestre_id}) if not sems: diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index 98c67431b1..299318ed75 100644 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -966,6 +966,7 @@ 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 + sem = sco_formsemestre.get_formsemestre(formsemestre_id, raise_soft_exc=True) modimpls = sco_moduleimpl.moduleimpl_withmodule_list( formsemestre_id=formsemestre_id @@ -987,7 +988,9 @@ def formsemestre_status(formsemestre_id=None): use_ue_coefs = sco_preferences.get_preference("use_ue_coefs", formsemestre_id) H = [ - html_sco_header.sco_header(page_title="Semestre %s" % sem["titreannee"]), + html_sco_header.sco_header( + page_title=f"{formsemestre.sem_modalite()} {formsemestre.titre_annee()}" + ), '
', formsemestre_status_head( formsemestre_id=formsemestre_id, page_title="Tableau de bord" diff --git a/app/templates/sco_value_error.html b/app/templates/sco_value_error.html index 8a54f61926..524f4d8831 100644 --- a/app/templates/sco_value_error.html +++ b/app/templates/sco_value_error.html @@ -1,6 +1,5 @@ {# -*- mode: jinja-html -*- #} {% extends 'base.html' %} -{% import 'bootstrap/wtf.html' as wtf %} {% block app_content %} diff --git a/app/views/notes.py b/app/views/notes.py index 061055f88e..d6c6e1b0d3 100644 --- a/app/views/notes.py +++ b/app/views/notes.py @@ -290,10 +290,9 @@ def formsemestre_bulletinetud( code_ine=None, ): format = format or "html" - if not formsemestre_id: - flask.abort(404, "argument manquant: formsemestre_id") + if not isinstance(formsemestre_id, int): - raise ScoInvalidIdType("formsemestre_id must be an integer !") + raise ValueError("formsemestre_id must be an integer !") formsemestre = FormSemestre.query.get_or_404(formsemestre_id) if etudid: etud = models.Identite.query.get_or_404(etudid) diff --git a/sco_version.py b/sco_version.py index a8d3aae110..24931a73be 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.2.6" +SCOVERSION = "9.2.7" SCONAME = "ScoDoc"