Fix: traitement erreur si code étape Apo invalide + ajout total ECTS sur fiche

This commit is contained in:
Emmanuel Viennet 2024-02-21 17:47:54 +01:00
parent 09d59848d6
commit 853bc31422
3 changed files with 38 additions and 14 deletions

View File

@ -36,7 +36,7 @@ import sqlalchemy as sa
from app import log from app import log
from app.auth.models import User from app.auth.models import User
from app.but import cursus_but from app.but import cursus_but, validations_view
from app.models import Adresse, EtudAnnotation, FormSemestre, Identite, ScoDocSiteConfig from app.models import Adresse, EtudAnnotation, FormSemestre, Identite, ScoDocSiteConfig
from app.scodoc import ( from app.scodoc import (
codes_cursus, codes_cursus,
@ -445,6 +445,14 @@ def fiche_etud(etudid=None):
# Liens vers compétences BUT # Liens vers compétences BUT
if last_formsemestre and last_formsemestre.formation.is_apc(): if last_formsemestre and last_formsemestre.formation.is_apc():
but_cursus = cursus_but.EtudCursusBUT(etud, last_formsemestre.formation) but_cursus = cursus_but.EtudCursusBUT(etud, last_formsemestre.formation)
refcomp = last_formsemestre.formation.referentiel_competence
if refcomp:
ue_validation_by_niveau = validations_view.get_ue_validation_by_niveau(
refcomp, etud
)
ects_total = sum((v.ects() for v in ue_validation_by_niveau.values()))
else:
ects_total = ""
info[ info[
"but_cursus_mkup" "but_cursus_mkup"
] = f""" ] = f"""
@ -454,6 +462,7 @@ def fiche_etud(etudid=None):
cursus=but_cursus, cursus=but_cursus,
scu=scu, scu=scu,
)} )}
<div class="fiche_but_col2">
<div class="link_validation_rcues"> <div class="link_validation_rcues">
<a class="stdlink" href="{url_for("notes.validation_rcues", <a class="stdlink" href="{url_for("notes.validation_rcues",
scodoc_dept=g.scodoc_dept, etudid=etudid, scodoc_dept=g.scodoc_dept, etudid=etudid,
@ -461,9 +470,13 @@ def fiche_etud(etudid=None):
title="Visualiser les compétences BUT" title="Visualiser les compétences BUT"
> >
<img src="/ScoDoc/static/icons/parcours-but.png" alt="validation_rcues" height="100px"/> <img src="/ScoDoc/static/icons/parcours-but.png" alt="validation_rcues" height="100px"/>
<div>Compétences BUT</div> <div style="text-align: center;">Compétences BUT</div>
</a> </a>
</div> </div>
<div class="fiche_total_etcs">
Total ECTS BUT: {ects_total:g}
</div>
</div>
</div> </div>
""" """
else: else:

View File

@ -25,12 +25,14 @@
# #
############################################################################## ##############################################################################
"""Classe stockant le VDI avec le code étape (noms de fichiers maquettes et code semestres) """Apogée: gestion du VDI avec le code étape (noms de fichiers maquettes et code semestres)
""" """
from app.scodoc.sco_exceptions import ScoValueError from app.scodoc.sco_exceptions import ScoValueError
class ApoEtapeVDI(object): class ApoEtapeVDI(object):
"""Classe stockant le VDI avec le code étape (noms de fichiers maquettes et code semestres)"""
_ETAPE_VDI_SEP = "!" _ETAPE_VDI_SEP = "!"
def __init__(self, etape_vdi: str = None, etape: str = "", vdi: str = ""): def __init__(self, etape_vdi: str = None, etape: str = "", vdi: str = ""):
@ -110,7 +112,8 @@ class ApoEtapeVDI(object):
elif len(t) == 2: elif len(t) == 2:
etape, vdi = t etape, vdi = t
else: else:
raise ValueError("invalid code etape") # code étape invalide
etape, vdi = "", ""
return etape, vdi return etape, vdi
else: else:
return etape_vdi, "" return etape_vdi, ""

View File

@ -962,10 +962,18 @@ td.fichetitre2 .fl {
div.section_but { div.section_but {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: flex-end;
justify-content: space-evenly; justify-content: space-evenly;
} }
div.fiche_but_col2 {
display: flex;
flex-direction: column;
justify-content: space-between;
}
div.fiche_total_etcs {
font-weight: bold;
margin-top: 16px;
}
div.section_but > div.link_validation_rcues { div.section_but > div.link_validation_rcues {
align-self: center; align-self: center;
text-align: center; text-align: center;