diff --git a/app/models/but_validations.py b/app/models/but_validations.py index d5e622ec..0c202be4 100644 --- a/app/models/but_validations.py +++ b/app/models/but_validations.py @@ -59,7 +59,11 @@ class ApcValidationRCUE(db.Model): parcour = db.relationship("ApcParcours") def __repr__(self): - return f"<{self.__class__.__name__} {self.id} {self.etud} {self.ue1}/{self.ue2}:{self.code!r}>" + return f"""<{self.__class__.__name__} {self.id} {self.etud} { + self.ue1}/{self.ue2}:{self.code!r}>""" + + def __str__(self): + return f"""décision sur RCUE {self.ue1.acronyme}/{self.ue2.acronyme}: {self.code}""" def niveau(self) -> ApcNiveau: """Le niveau de compétence associé à cet RCUE.""" @@ -301,6 +305,9 @@ class ApcValidationAnnee(db.Model): def __repr__(self): return f"<{self.__class__.__name__} {self.id} {self.etud} BUT{self.ordre}/{self.annee_scolaire}:{self.code!r}>" + def __str__(self): + return f"""décision sur année BUT{self.ordre} {self.annee_scolaire} : {self.code}""" + def to_dict_bul(self) -> dict: "dict pour bulletins" return { diff --git a/app/models/events.py b/app/models/events.py index 4e566cbd..39938978 100644 --- a/app/models/events.py +++ b/app/models/events.py @@ -13,7 +13,6 @@ from app import email from app import log from app.auth.models import User from app.models import SHORT_STR_LEN -from app.models.formsemestre import FormSemestre from app.models.moduleimpls import ModuleImpl import app.scodoc.sco_utils as scu from app.scodoc import sco_preferences @@ -170,10 +169,12 @@ class ScolarNews(db.Model): log(f"news: {news}") news.notify_by_mail() - def get_news_formsemestre(self) -> FormSemestre: + def get_news_formsemestre(self) -> "FormSemestre": """formsemestre concerné par la nouvelle None si inexistant """ + from app.models.formsemestre import FormSemestre + formsemestre_id = None if self.type == self.NEWS_INSCR: formsemestre_id = self.object diff --git a/app/models/formsemestre.py b/app/models/formsemestre.py index ef700ace..5742da15 100644 --- a/app/models/formsemestre.py +++ b/app/models/formsemestre.py @@ -31,9 +31,11 @@ from app.models.groups import GroupDescr, Partition import app.scodoc.sco_utils as scu from app.models.but_refcomp import parcours_formsemestre from app.models.etudiants import Identite +from app.models.formations import Formation from app.models.modules import Module from app.models.moduleimpls import ModuleImpl from app.models.ues import UniteEns +from app.models.validations import ScolarFormSemestreValidation from app.scodoc import sco_codes_parcours from app.scodoc import sco_preferences @@ -648,6 +650,46 @@ class FormSemestre(db.Model): ) db.session.commit() + def etud_validations_description_html(self, etudid: int) -> str: + """Description textuelle des validations de jury de cet étudiant dans ce semestre""" + from app.models.but_validations import ApcValidationRCUE, ApcValidationAnnee + + vals_sem = ScolarFormSemestreValidation.query.filter_by( + etudid=etudid, formsemestre_id=self.id, ue_id=None + ).all() + vals_ues = ( + ScolarFormSemestreValidation.query.filter_by( + etudid=etudid, formsemestre_id=self.id + ) + .join(UniteEns) + .order_by(UniteEns.numero) + .all() + ) + # Validations BUT: + vals_rcues = ( + ApcValidationRCUE.query.filter_by(etudid=etudid, formsemestre_id=self.id) + .join(UniteEns, ApcValidationRCUE.ue1) + .order_by(UniteEns.numero) + .all() + ) + vals_annee = ( + ApcValidationAnnee.query.filter_by( + etudid=etudid, + annee_scolaire=self.annee_scolaire(), + ) + .join(ApcValidationAnnee.formsemestre) + .join(FormSemestre.formation) + .filter(Formation.formation_code == self.formation.formation_code) + .all() + ) + H = [] + for vals in (vals_sem, vals_ues, vals_rcues, vals_annee): + if vals: + H.append( + f"""""" + ) + return "\n".join(H) + # Association id des utilisateurs responsables (aka directeurs des etudes) du semestre notes_formsemestre_responsables = db.Table( diff --git a/app/models/validations.py b/app/models/validations.py index fb470b97..2466e08e 100644 --- a/app/models/validations.py +++ b/app/models/validations.py @@ -53,11 +53,20 @@ class ScolarFormSemestreValidation(db.Model): ) ue = db.relationship("UniteEns", lazy="select", uselist=False) + formsemestre = db.relationship( + "FormSemestre", lazy="select", uselist=False, foreign_keys=[formsemestre_id] + ) def __repr__(self): return f"{self.__class__.__name__}({self.formsemestre_id}, {self.etudid}, code={self.code}, ue={self.ue}, moy_ue={self.moy_ue})" + def __str__(self): + if self.ue_id: + return f"""décision sur UE {self.ue.acronyme}: {self.code}""" + return f"""décision sur semestre {self.formsemestre.titre_mois()} du {self.event_date.strftime("%d/%m/%Y")}""" + def to_dict(self) -> dict: + "as a dict" d = dict(self.__dict__) d.pop("_sa_instance_state", None) return d @@ -84,6 +93,7 @@ class ScolarAutorisationInscription(db.Model): ) def to_dict(self) -> dict: + "as a dict" d = dict(self.__dict__) d.pop("_sa_instance_state", None) return d diff --git a/app/views/notes.py b/app/views/notes.py index e9dcfbe8..30b10b38 100644 --- a/app/views/notes.py +++ b/app/views/notes.py @@ -2270,11 +2270,11 @@ def formsemestre_validation_but( return ( "\n".join(H) + f"""
Impossible de statuer sur cet étudiant: - il est démissionnaire ou défaillant (voir sa fiche)
-
retour à la liste
diff --git a/app/views/scolar.py b/app/views/scolar.py index 505cff5b..58211d7a 100644 --- a/app/views/scolar.py +++ b/app/views/scolar.py @@ -1106,6 +1106,7 @@ def _form_dem_of_def( header = html_sco_header.sco_header( page_title=f"""{operation_name} de {etud.nomprenom} (du semestre {formsemestre.titre_mois()})""" ) + validations_descr = formsemestre.etud_validations_description_html(etudid) return f""" {header}

{operation_name} de {etud.nomprenom} ({formsemestre.titre_mois()})

@@ -1118,6 +1119,15 @@ def _form_dem_of_def(
+ +
+ {'

Attention: il y a des décisions de jury déjà prises !

' if validations_descr else ""} + {validations_descr} + {('

modifier ces décisions

') if validations_descr else ""} +
{html_sco_header.sco_footer()} """ diff --git a/sco_version.py b/sco_version.py index d22cf8c3..d6a30ac7 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.3.48" +SCOVERSION = "9.3.49" SCONAME = "ScoDoc"