etuds_sans_notes: template

This commit is contained in:
Emmanuel Viennet 2024-07-19 19:04:07 +02:00
parent b80d8fb454
commit 929fe397ad
2 changed files with 68 additions and 61 deletions

View File

@ -74,6 +74,7 @@ from app.scodoc import sco_users
from app.scodoc.gen_tables import GenTable
from app.scodoc.html_sidebar import retreive_formsemestre_from_request
from app.scodoc.sco_formsemestre_custommenu import formsemestre_custommenu_html
import sco_version
@ -1066,9 +1067,6 @@ def formsemestre_status(formsemestre_id=None, check_parcours=True):
use_ue_coefs = sco_preferences.get_preference("use_ue_coefs", formsemestre_id)
H = [
html_sco_header.sco_header(
page_title=f"{formsemestre.sem_modalite()} {formsemestre.titre_annee()}"
),
'<div class="formsemestre_status">',
formsemestre_status_head(
formsemestre_id=formsemestre_id, page_title="Tableau de bord"
@ -1191,7 +1189,11 @@ def formsemestre_status(formsemestre_id=None, check_parcours=True):
len(adrlist)} enseignants du semestre</a>
</p>"""
)
return "".join(H) + html_sco_header.sco_footer()
return render_template(
"sco_page.j2",
content="".join(H),
title=f"{formsemestre.sem_modalite()} {formsemestre.titre_annee()}",
)
_TABLEAU_MODULES_HEAD = """
@ -1452,7 +1454,10 @@ def formsemestre_note_etuds_sans_notes(
):
"""Affichage et saisie des étudiants sans notes
Si etudid est spécifié, traite un seul étudiant."""
Si etudid est spécifié, traite un seul étudiant.
"""
from app.views import ScoData
formsemestre: FormSemestre = FormSemestre.query.filter_by(
id=formsemestre_id, dept_id=g.scodoc_dept_id
).first_or_404()
@ -1477,61 +1482,19 @@ def formsemestre_note_etuds_sans_notes(
formsemestre_id=formsemestre.id,
)
)
if not etuds:
if etudid is None:
message = """<h3>aucun étudiant sans notes</h3>"""
else:
flash(
f"""{Identite.get_etud(etudid).nomprenom}
if not etuds and etudid is not None:
flash(
f"""{Identite.get_etud(etudid).nomprenom}
a déjà des notes"""
)
return redirect(
url_for("scolar.fiche_etud", scodoc_dept=g.scodoc_dept, etudid=etudid)
)
else:
noms = "</li><li>".join(
[
f"""<a href="{
url_for("scolar.fiche_etud", scodoc_dept=g.scodoc_dept, etudid=etud.id)
}" class="discretelink">{etud.nomprenom}</a>"""
for etud in etuds
]
)
message = f"""
<h3>Étudiants sans notes:</h3>
<ul>
<li>{noms}</li>
</ul>
"""
return f"""
{html_sco_header.sco_header(
page_title=f"{formsemestre.sem_modalite()} {formsemestre.titre_annee()}"
)}
<div class="formsemestre_status">
{formsemestre_status_head(
formsemestre_id=formsemestre_id, page_title="Étudiants sans notes"
)}
</div>
{message}
<style>
.sco-std-form select, .sco-std-form input[type="submit"] {{
height: 24px;
}}
</style>
<form class="sco-std-form" method="post">
<input type="hidden" name="formsemestre_id" value="{formsemestre.id}">
<input type="hidden" name="etudid" value="{etudid or ""}">
Mettre toutes les notes de {"ces étudiants" if len(etuds)> 1 else "cet étudiant"}
à&nbsp;:
<select name="code">
<option value="ABS">ABS (absent, compte zéro)</option>
<option value="ATT" selected>ATT (en attente)</option>
<option value="EXC">EXC (neutralisée)</option>
</select>
<input type="submit" value="Enregistrer">
</form>
{html_sco_header.sco_footer()}
"""
return redirect(
url_for("scolar.fiche_etud", scodoc_dept=g.scodoc_dept, etudid=etudid)
)
etud = Identite.get_etud(etudid) if etudid is not None else None
return render_template(
"formsemestre/etuds_sans_notes.j2",
etudid=etudid,
etuds=etuds,
sco=ScoData(formsemestre=formsemestre, etud=etud),
title=f"{formsemestre.sem_modalite()} {formsemestre.titre_annee()}",
)

View File

@ -0,0 +1,44 @@
{% extends "sco_page.j2" %}
{% block styles %}
{{super()}}
<style>
.sco-std-form select, .sco-std-form input[type="submit"] {
height: 24px;
}
</style>
{% endblock %}
{% block app_content %}
{% if not etuds %}
<h3>aucun étudiant sans notes</h3>
{% else %}
<h3>Étudiants sans notes:</h3>
<ul>
{% for etud in etuds %}
<li>
<a href="{{
url_for('scolar.fiche_etud', scodoc_dept=g.scodoc_dept, etudid=etud.id)
}}" class="discretelink">{{etud.nom_prenom()}}</a>
</li>
{% endfor %}
</ul>
<form class="sco-std-form" method="post">
<input type="hidden" name="formsemestre_id" value="{{sco.formsemestre.id}}">
<input type="hidden" name="etudid" value="{{etudid or ''}}">
Mettre toutes les notes de
{{"ces étudiants" if etuds|length > 1 else "cet étudiant"}}
à&nbsp;:
<select name="code">
<option value="ABS">ABS (absent, compte zéro)</option>
<option value="ATT" selected>ATT (en attente)</option>
<option value="EXC">EXC (neutralisée)</option>
</select>
<input type="submit" value="Enregistrer">
</form>
{% endif %}
{% endblock %}