From 929fe397ad4f59ea1fc945d207262cf6f433b331 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 19 Jul 2024 19:04:07 +0200 Subject: [PATCH] etuds_sans_notes: template --- app/scodoc/sco_formsemestre_status.py | 85 ++++++------------- .../formsemestre/etuds_sans_notes.j2 | 44 ++++++++++ 2 files changed, 68 insertions(+), 61 deletions(-) create mode 100644 app/templates/formsemestre/etuds_sans_notes.j2 diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index 53d00800e..78338f33f 100755 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -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()}" - ), '
', 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

""" ) - 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 = """

aucun étudiant sans notes

""" - 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 = "
  • ".join( - [ - f"""{etud.nomprenom}""" - for etud in etuds - ] ) - message = f""" -

    Étudiants sans notes:

    -
      -
    • {noms}
    • -
    - """ - - return f""" - {html_sco_header.sco_header( - page_title=f"{formsemestre.sem_modalite()} {formsemestre.titre_annee()}" - )} -
    - {formsemestre_status_head( - formsemestre_id=formsemestre_id, page_title="Étudiants sans notes" - )} -
    - {message} - - -
    - - - - Mettre toutes les notes de {"ces étudiants" if len(etuds)> 1 else "cet étudiant"} - à : - - -
    - {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()}", + ) diff --git a/app/templates/formsemestre/etuds_sans_notes.j2 b/app/templates/formsemestre/etuds_sans_notes.j2 new file mode 100644 index 000000000..96dc513a5 --- /dev/null +++ b/app/templates/formsemestre/etuds_sans_notes.j2 @@ -0,0 +1,44 @@ +{% extends "sco_page.j2" %} + +{% block styles %} +{{super()}} + +{% endblock %} + +{% block app_content %} + +{% if not etuds %} +

    aucun étudiant sans notes

    +{% else %} +

    Étudiants sans notes:

    + + +
    + + + + Mettre toutes les notes de + {{"ces étudiants" if etuds|length > 1 else "cet étudiant"}} + à : + + +
    +{% endif %} + +{% endblock %}