From 3d8fe461b9949adf4407ef4de9e289dfe40e0f38 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sat, 18 Dec 2021 12:16:49 +0100 Subject: [PATCH] ajout titres pages (liste evals, bul.) --- app/but/bulletin_but.py | 4 +-- app/scodoc/sco_liste_notes.py | 52 ++++++++++++++++++----------------- app/templates/sco_page.html | 8 +++--- app/views/notes.py | 28 +++++++++++-------- 4 files changed, 50 insertions(+), 42 deletions(-) diff --git a/app/but/bulletin_but.py b/app/but/bulletin_but.py index 79423197f..cd1c59a5d 100644 --- a/app/but/bulletin_but.py +++ b/app/but/bulletin_but.py @@ -149,9 +149,9 @@ class ResultatsSemestreBUT: """dict synthèse résultats des modules indiqués, avec évaluations de chacun.""" d = {} - etud_idx = self.etud_index[etud.id] + # etud_idx = self.etud_index[etud.id] for mi in modimpls: - mod_idx = self.modimpl_coefs_df.columns.get_loc(mi.id) + # mod_idx = self.modimpl_coefs_df.columns.get_loc(mi.id) # # moyennes indicatives (moyennes de moyennes d'UE) # try: # moyennes_etuds = np.nan_to_num( diff --git a/app/scodoc/sco_liste_notes.py b/app/scodoc/sco_liste_notes.py index fd4181ea9..517d172df 100644 --- a/app/scodoc/sco_liste_notes.py +++ b/app/scodoc/sco_liste_notes.py @@ -53,35 +53,34 @@ from app.scodoc.gen_tables import GenTable from app.scodoc.htmlutils import histogram_notes -def do_evaluation_listenotes(): +def do_evaluation_listenotes( + evaluation_id=None, moduleimpl_id=None, format="html" +) -> str: """ - Affichage des notes d'une évaluation - - args: evaluation_id ou moduleimpl_id - (si moduleimpl_id, affiche toutes les évaluations du module) + Affichage des notes d'une évaluation (si evaluation_id) + ou de toutes les évaluations d'un module (si moduleimpl_id) """ mode = None - vals = scu.get_request_args() - if "evaluation_id" in vals: - evaluation_id = int(vals["evaluation_id"]) - mode = "eval" - evals = sco_evaluation_db.do_evaluation_list({"evaluation_id": evaluation_id}) - if "moduleimpl_id" in vals and vals["moduleimpl_id"]: - moduleimpl_id = int(vals["moduleimpl_id"]) + if moduleimpl_id: mode = "module" evals = sco_evaluation_db.do_evaluation_list({"moduleimpl_id": moduleimpl_id}) - if not mode: + elif evaluation_id: + mode = "eval" + evals = sco_evaluation_db.do_evaluation_list({"evaluation_id": evaluation_id}) + else: raise ValueError("missing argument: evaluation or module") if not evals: return "

Aucune évaluation !

" - format = vals.get("format", "html") E = evals[0] # il y a au moins une evaluation + modimpl = ModuleImpl.query.get(E["moduleimpl_id"]) # description de l'evaluation if mode == "eval": H = [sco_evaluations.evaluation_describe(evaluation_id=evaluation_id)] + page_title = f"Notes {E['description'] or modimpl.module.code}" else: H = [] + page_title = f"Notes {modimpl.module.code}" # groupes groups = sco_groups.do_evaluation_listegroupes( E["evaluation_id"], include_default=True @@ -187,7 +186,7 @@ def do_evaluation_listenotes(): is_submitted=True, # toujours "soumis" (démarre avec liste complète) ) if tf[0] == 0: - return "\n".join(H) + "\n" + tf[1] + return "\n".join(H) + "\n" + tf[1], page_title elif tf[0] == -1: return flask.redirect( "%s/Notes/moduleimpl_status?moduleimpl_id=%s" @@ -198,16 +197,19 @@ def do_evaluation_listenotes(): note_sur_20 = tf[2]["note_sur_20"] hide_groups = tf[2]["hide_groups"] with_emails = tf[2]["with_emails"] - return _make_table_notes( - tf[1], - evals, - format=format, - note_sur_20=note_sur_20, - anonymous_listing=anonymous_listing, - group_ids=tf[2]["group_ids"], - hide_groups=hide_groups, - with_emails=with_emails, - mode=mode, + return ( + _make_table_notes( + tf[1], + evals, + format=format, + note_sur_20=note_sur_20, + anonymous_listing=anonymous_listing, + group_ids=tf[2]["group_ids"], + hide_groups=hide_groups, + with_emails=with_emails, + mode=mode, + ), + page_title, ) diff --git a/app/templates/sco_page.html b/app/templates/sco_page.html index 0ebe6e195..249bfb39e 100644 --- a/app/templates/sco_page.html +++ b/app/templates/sco_page.html @@ -12,7 +12,7 @@ {% endblock %} {% block title %} -{% if title %}{{ title }} - ScoDoc{% else %}Welcome to ScoDoc{% endif %} +{% if title %}{{ title }} - ScoDoc{% else %}ScoDoc{% endif %} {% endblock %} {% block content %} @@ -31,9 +31,9 @@ {% endwith %} {% if sco.sem %} - {% block formsemestre_header %} - {% include "formsemestre_header.html" %} - {% endblock %} + {% block formsemestre_header %} + {% include "formsemestre_header.html" %} + {% endblock %} {% endif %} {% block app_content %} diff --git a/app/views/notes.py b/app/views/notes.py index a7ed9fd55..30222830a 100644 --- a/app/views/notes.py +++ b/app/views/notes.py @@ -301,7 +301,7 @@ def formsemestre_bulletinetud( elif format == "html": return render_template( "but/bulletin.html", - title="Bulletin BUT", + title=f"Bul. {etud.nom} - BUT", bul_url=url_for( "notes.formsemestre_bulletinetud", scodoc_dept=g.scodoc_dept, @@ -1728,27 +1728,33 @@ def evaluation_create(moduleimpl_id): @scodoc7func def evaluation_listenotes(): """Affichage des notes d'une évaluation""" - if request.args.get("format", "html") == "html": + evaluation_id = None + moduleimpl_id = None + vals = scu.get_request_args() + if "evaluation_id" in vals: + evaluation_id = int(vals["evaluation_id"]) + mode = "eval" + if "moduleimpl_id" in vals and vals["moduleimpl_id"]: + moduleimpl_id = int(vals["moduleimpl_id"]) + mode = "module" + + format = vals.get("format", "html") + B, page_title = sco_liste_notes.do_evaluation_listenotes( + evaluation_id=evaluation_id, moduleimpl_id=moduleimpl_id, format=format + ) + if format == "html": H = html_sco_header.sco_header( + page_title=page_title, cssstyles=["css/verticalhisto.css"], javascripts=["js/etud_info.js"], init_qtip=True, ) F = html_sco_header.sco_footer() - else: - H, F = "", "" - B = sco_liste_notes.do_evaluation_listenotes() - if H: return H + B + F else: return B -sco_publish( - "/do_evaluation_listenotes", - sco_liste_notes.do_evaluation_listenotes, - Permission.ScoView, -) sco_publish( "/evaluation_list_operations", sco_undo_notes.evaluation_list_operations,