ajout titres pages (liste evals, bul.)

This commit is contained in:
Emmanuel Viennet 2021-12-18 12:16:49 +01:00
parent 6d7645a599
commit 3d8fe461b9
4 changed files with 50 additions and 42 deletions

View File

@ -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(

View File

@ -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 "<p>Aucune évaluation !</p>"
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,
)

View File

@ -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 %}
</div>
{% if sco.sem %}
{% block formsemestre_header %}
{% include "formsemestre_header.html" %}
{% endblock %}
{% block formsemestre_header %}
{% include "formsemestre_header.html" %}
{% endblock %}
{% endif %}
{% block app_content %}

View File

@ -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,