Fix #570 liens PREV/NEXT si un seul étudiant dans le semestre

This commit is contained in:
Emmanuel Viennet 2023-01-23 18:11:24 -03:00
parent 90aa6234bd
commit c215d56461

View File

@ -2350,7 +2350,7 @@ def formsemestre_validation_but(
etud: Identite = Identite.query.filter_by(
id=etudid, dept_id=g.scodoc_dept_id
).first_or_404()
nb_etuds = formsemestre.etuds.count()
# la route ne donne pas le type d'etudid pour pouvoir construire des URLs
# provisoires avec NEXT et PREV
try:
@ -2360,16 +2360,24 @@ def formsemestre_validation_but(
read_only = not sco_permissions_check.can_validate_sem(formsemestre_id)
# --- Navigation
prev_lnk = f"""{scu.EMO_PREV_ARROW}&nbsp;<a href="{url_for(
prev_lnk = (
f"""{scu.EMO_PREV_ARROW}&nbsp;<a href="{url_for(
"notes.formsemestre_validation_but", scodoc_dept=g.scodoc_dept,
formsemestre_id=formsemestre_id, etudid="PREV"
)}" class="stdlink"">précédent</a>
"""
next_lnk = f"""<a href="{url_for(
if nb_etuds > 1
else ""
)
next_lnk = (
f"""<a href="{url_for(
"notes.formsemestre_validation_but", scodoc_dept=g.scodoc_dept,
formsemestre_id=formsemestre_id, etudid="NEXT"
)}" class="stdlink"">suivant</a>&nbsp;{scu.EMO_NEXT_ARROW}
"""
if nb_etuds > 1
else ""
)
navigation_div = f"""
<div class="but_navigation">
<div class="prev">