diff --git a/app/models/etudiants.py b/app/models/etudiants.py index 3aacb66a..b1fec609 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 98fc64a2..11792057 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 98c67431..299318ed 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()}" + ), '