From 8d607190acdd6e71306c4f716952b6055eba9d10 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 27 Sep 2022 12:21:19 +0200 Subject: [PATCH] =?UTF-8?q?Am=C3=A9liore=20page=20inscription=20autre=20se?= =?UTF-8?q?mestre?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_formsemestre_inscriptions.py | 63 +++++++++++++-------- app/scodoc/sco_page_etud.py | 23 +++++--- app/views/scolar.py | 18 +++--- 3 files changed, 61 insertions(+), 43 deletions(-) diff --git a/app/scodoc/sco_formsemestre_inscriptions.py b/app/scodoc/sco_formsemestre_inscriptions.py index 2c99c685..8236f2ab 100644 --- a/app/scodoc/sco_formsemestre_inscriptions.py +++ b/app/scodoc/sco_formsemestre_inscriptions.py @@ -34,7 +34,7 @@ from flask import flash, url_for, g, request from app.comp import res_sem from app.comp.res_compat import NotesTableCompat -from app.models import FormSemestre, FormSemestreInscription +from app.models import Formation, FormSemestre, FormSemestreInscription from app.models.etudiants import Identite from app.models.groups import GroupDescr import app.scodoc.sco_utils as scu @@ -317,50 +317,63 @@ def formsemestre_inscription_with_modules_form(etudid, only_ext=False): """Formulaire inscription de l'etud dans l'un des semestres existants. Si only_ext, ne montre que les semestre extérieurs. """ - etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0] + etud: Identite = Identite.query.filter_by( + id=etudid, dept_id=g.scodoc_dept_id + ).first_or_404() H = [ html_sco_header.sco_header(), - "

Inscription de %s" % etud["nomprenom"], + f"

Inscription de {etud.nomprenom}", ] if only_ext: H.append(" dans un semestre extérieur") H.append( """

-

L'étudiant sera inscrit à tous les modules du semestre +

L'étudiant sera inscrit à tous les modules du semestre choisi (sauf Sport & Culture).

Choisir un semestre:

""" ) - F = html_sco_header.sco_footer() - sems = sco_formsemestre.do_formsemestre_list(args={"etat": "1"}) - insem = do_formsemestre_inscription_list(args={"etudid": etudid, "etat": "I"}) - if sems: + footer = html_sco_header.sco_footer() + # sems = sco_formsemestre.do_formsemestre_list(args={"etat": "1"}) + formsemestres = ( + FormSemestre.query.filter_by(etat=True, dept_id=g.scodoc_dept_id) + .join(Formation) + .order_by( + Formation.acronyme, + FormSemestre.semestre_id, + FormSemestre.modalite, + FormSemestre.date_debut, + ) + .all() + ) + if len(formsemestres): H.append("") else: H.append("

aucune session de formation !

") H.append( - '

ou

retour à la fiche de %s' - % ( - url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid), - etud["nomprenom"], - ) + f"""

ou

retour à la fiche de {etud.nomprenom}""" ) - return "\n".join(H) + F + return "\n".join(H) + footer def formsemestre_inscription_with_modules( diff --git a/app/scodoc/sco_page_etud.py b/app/scodoc/sco_page_etud.py index 35df70c3..79a33d0d 100644 --- a/app/scodoc/sco_page_etud.py +++ b/app/scodoc/sco_page_etud.py @@ -208,10 +208,12 @@ def ficheEtud(etudid=None): info["emaillink"] = "(pas d'adresse e-mail)" # Champ dépendant des permissions: if authuser.has_permission(Permission.ScoEtudChangeAdr): - info["modifadresse"] = ( - 'modifier adresse' - % etudid - ) + info[ + "modifadresse" + ] = f"""modifier adresse""" else: info["modifadresse"] = "" @@ -235,7 +237,7 @@ def ficheEtud(etudid=None): info["ne"], show_date_inscr=False, ) - grlink = '%s' % descr["situation"] + grlink = f"""{descr["situation"]}""" else: e = {"etudid": etudid} sco_groups.etud_add_group_infos( @@ -287,17 +289,20 @@ def ficheEtud(etudid=None): info[ "link_inscrire_ailleurs" ] = f"""inscrire à un autre semestre""" else: info["link_inscrire_ailleurs"] = "" else: # non inscrit - l = ["

Etudiant%s non inscrit%s" % (info["ne"], info["ne"])] + l = [f"""

Étudiant{info["ne"]} non inscrit{info["ne"]}"""] if authuser.has_permission(Permission.ScoEtudInscrit): l.append( - 'inscrire' - % (scu.ScoURL(), etudid) + f"""inscrire""" ) l.append("") info["liste_inscriptions"] = "\n".join(l) diff --git a/app/views/scolar.py b/app/views/scolar.py index ffd5a080..ed8e93d7 100644 --- a/app/views/scolar.py +++ b/app/views/scolar.py @@ -740,26 +740,26 @@ def doSuppressAnnotation(etudid, annotation_id): ) -@bp.route("/formChangeCoordonnees", methods=["GET", "POST"]) +@bp.route("/form_change_coordonnees", methods=["GET", "POST"]) @scodoc @permission_required(Permission.ScoEtudChangeAdr) @scodoc7func -def formChangeCoordonnees(etudid): +def form_change_coordonnees(etudid): "edit coordonnees etudiant" + etud = Identite.query.get_or_404(etudid) cnx = ndb.GetDBConnexion() - etud = sco_etud.get_etud_info(filled=True, etudid=etudid)[0] adrs = sco_etud.adresse_list(cnx, {"etudid": etudid}) if adrs: adr = adrs[0] else: adr = {} # no data for this student H = [ - '

Changement des coordonnées de %(nomprenom)s

' - % etud + f"""{html_sco_header.sco_header( + page_title=f"Changement coordonnées de {etud.nomprenom}" + )} +

Changement des coordonnées de {etud.nomprenom}

+

""" ] - header = html_sco_header.sco_header( - page_title="Changement adresse de %(nomprenom)s" % etud - ) tf = TrivialFormulator( request.base_url, @@ -799,7 +799,7 @@ def formChangeCoordonnees(etudid): ) dest_url = url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid) if tf[0] == 0: - return header + "\n".join(H) + tf[1] + html_sco_header.sco_footer() + return "\n".join(H) + tf[1] + html_sco_header.sco_footer() elif tf[0] == -1: return flask.redirect(dest_url) else: