1
0
forked from ScoDoc/ScoDoc

Liste décisions sur page démission. Closes #499

This commit is contained in:
Emmanuel Viennet 2022-10-01 10:39:46 +02:00
parent 2731a4728b
commit 0c5e338970
7 changed files with 76 additions and 6 deletions

View File

@ -59,7 +59,11 @@ class ApcValidationRCUE(db.Model):
parcour = db.relationship("ApcParcours") parcour = db.relationship("ApcParcours")
def __repr__(self): 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: def niveau(self) -> ApcNiveau:
"""Le niveau de compétence associé à cet RCUE.""" """Le niveau de compétence associé à cet RCUE."""
@ -301,6 +305,9 @@ class ApcValidationAnnee(db.Model):
def __repr__(self): def __repr__(self):
return f"<{self.__class__.__name__} {self.id} {self.etud} BUT{self.ordre}/{self.annee_scolaire}:{self.code!r}>" 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: def to_dict_bul(self) -> dict:
"dict pour bulletins" "dict pour bulletins"
return { return {

View File

@ -13,7 +13,6 @@ from app import email
from app import log from app import log
from app.auth.models import User from app.auth.models import User
from app.models import SHORT_STR_LEN from app.models import SHORT_STR_LEN
from app.models.formsemestre import FormSemestre
from app.models.moduleimpls import ModuleImpl from app.models.moduleimpls import ModuleImpl
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc import sco_preferences from app.scodoc import sco_preferences
@ -170,10 +169,12 @@ class ScolarNews(db.Model):
log(f"news: {news}") log(f"news: {news}")
news.notify_by_mail() news.notify_by_mail()
def get_news_formsemestre(self) -> FormSemestre: def get_news_formsemestre(self) -> "FormSemestre":
"""formsemestre concerné par la nouvelle """formsemestre concerné par la nouvelle
None si inexistant None si inexistant
""" """
from app.models.formsemestre import FormSemestre
formsemestre_id = None formsemestre_id = None
if self.type == self.NEWS_INSCR: if self.type == self.NEWS_INSCR:
formsemestre_id = self.object formsemestre_id = self.object

View File

@ -31,9 +31,11 @@ from app.models.groups import GroupDescr, Partition
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.models.but_refcomp import parcours_formsemestre from app.models.but_refcomp import parcours_formsemestre
from app.models.etudiants import Identite from app.models.etudiants import Identite
from app.models.formations import Formation
from app.models.modules import Module from app.models.modules import Module
from app.models.moduleimpls import ModuleImpl from app.models.moduleimpls import ModuleImpl
from app.models.ues import UniteEns from app.models.ues import UniteEns
from app.models.validations import ScolarFormSemestreValidation
from app.scodoc import sco_codes_parcours from app.scodoc import sco_codes_parcours
from app.scodoc import sco_preferences from app.scodoc import sco_preferences
@ -648,6 +650,46 @@ class FormSemestre(db.Model):
) )
db.session.commit() 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"""<ul><li>{"</li><li>".join(str(x) for x in vals)}</li></ul>"""
)
return "\n".join(H)
# Association id des utilisateurs responsables (aka directeurs des etudes) du semestre # Association id des utilisateurs responsables (aka directeurs des etudes) du semestre
notes_formsemestre_responsables = db.Table( notes_formsemestre_responsables = db.Table(

View File

@ -53,11 +53,20 @@ class ScolarFormSemestreValidation(db.Model):
) )
ue = db.relationship("UniteEns", lazy="select", uselist=False) ue = db.relationship("UniteEns", lazy="select", uselist=False)
formsemestre = db.relationship(
"FormSemestre", lazy="select", uselist=False, foreign_keys=[formsemestre_id]
)
def __repr__(self): def __repr__(self):
return f"{self.__class__.__name__}({self.formsemestre_id}, {self.etudid}, code={self.code}, ue={self.ue}, moy_ue={self.moy_ue})" 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: def to_dict(self) -> dict:
"as a dict"
d = dict(self.__dict__) d = dict(self.__dict__)
d.pop("_sa_instance_state", None) d.pop("_sa_instance_state", None)
return d return d
@ -84,6 +93,7 @@ class ScolarAutorisationInscription(db.Model):
) )
def to_dict(self) -> dict: def to_dict(self) -> dict:
"as a dict"
d = dict(self.__dict__) d = dict(self.__dict__)
d.pop("_sa_instance_state", None) d.pop("_sa_instance_state", None)
return d return d

View File

@ -2270,11 +2270,11 @@ def formsemestre_validation_but(
return ( return (
"\n".join(H) "\n".join(H)
+ f"""<div class="warning">Impossible de statuer sur cet étudiant: + f"""<div class="warning">Impossible de statuer sur cet étudiant:
il est démissionnaire ou défaillant (voir <a href="{ il est démissionnaire ou défaillant (voir <a class="stdlink" href="{
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid) url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
}">sa fiche</a>) }">sa fiche</a>)
</div> </div>
<div><a href="{url_for( <div><a class="stdlink" href="{url_for(
"notes.formsemestre_saisie_jury", scodoc_dept=g.scodoc_dept, "notes.formsemestre_saisie_jury", scodoc_dept=g.scodoc_dept,
formsemestre_id=formsemestre_id, selected_etudid=etud.id formsemestre_id=formsemestre_id, selected_etudid=etud.id
)}">retour à la liste</a></div> )}">retour à la liste</a></div>

View File

@ -1106,6 +1106,7 @@ def _form_dem_of_def(
header = html_sco_header.sco_header( header = html_sco_header.sco_header(
page_title=f"""{operation_name} de {etud.nomprenom} (du semestre {formsemestre.titre_mois()})""" page_title=f"""{operation_name} de {etud.nomprenom} (du semestre {formsemestre.titre_mois()})"""
) )
validations_descr = formsemestre.etud_validations_description_html(etudid)
return f""" return f"""
{header} {header}
<h2><font color="#FF0000">{operation_name} de</font> {etud.nomprenom} ({formsemestre.titre_mois()})</h2> <h2><font color="#FF0000">{operation_name} de</font> {etud.nomprenom} ({formsemestre.titre_mois()})</h2>
@ -1118,6 +1119,15 @@ def _form_dem_of_def(
<input type="hidden" name="formsemestre_id" value="{formsemestre_id}"> <input type="hidden" name="formsemestre_id" value="{formsemestre_id}">
<div class="vertical_spacing_but"><input type="submit" value="Confirmer"></div> <div class="vertical_spacing_but"><input type="submit" value="Confirmer"></div>
</form> </form>
<div class="rappel_decisions">
{'<p class="warning">Attention: il y a des décisions de jury déjà prises !</p>' if validations_descr else ""}
{validations_descr}
{('<p><a class="stdlink" href="'
+ url_for("notes.formsemestre_validation_but", scodoc_dept=g.scodoc_dept,
formsemestre_id=formsemestre_id,etudid=etudid)
+ '">modifier ces décisions</a></p>') if validations_descr else ""}
</div>
{html_sco_header.sco_footer()} {html_sco_header.sco_footer()}
""" """

View File

@ -1,7 +1,7 @@
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
SCOVERSION = "9.3.48" SCOVERSION = "9.3.49"
SCONAME = "ScoDoc" SCONAME = "ScoDoc"