bordereau (contrib Pascal B.).

This commit is contained in:
Emmanuel Viennet 2021-12-06 23:15:55 +01:00
commit 7d5160bb83
2 changed files with 57 additions and 14 deletions

View File

@ -652,12 +652,17 @@ def evaluation_describe(evaluation_id="", edit_in_place=True):
)
else:
# date et absences (pas pour evals de malus)
jour = E["jour"] or "<em>pas de date</em>"
H.append(
"<p>Réalisée le <b>%s</b> de %s à %s "
% (jour, E["heure_debut"], E["heure_fin"])
)
if E["jour"]:
jour = E["jour"]
H.append(
"<p>Réalisée le <b>%s</b> "
% (jour)
)
if E["heure_debut"] != E["heure_fin"]:
H.append(
"de %s à %s "
% (E["heure_debut"], E["heure_fin"])
)
group_id = sco_groups.get_default_group(formsemestre_id)
H.append(
f"""<span class="noprint"><a href="{url_for(
@ -668,6 +673,13 @@ def evaluation_describe(evaluation_id="", edit_in_place=True):
)
}">(absences ce jour)</a></span>"""
)
else:
jour = "<em>pas de date</em>"
H.append(
"<p>Réalisée le <b>%s</b> "
% (jour)
)
H.append(
'</p><p>Coefficient dans le module: <b>%s</b>, notes sur <span id="eval_note_max">%g</span> '
% (E["coefficient"], E["note_max"])

View File

@ -1,4 +1,4 @@
# -*- mode: python -*-
# -*- mode: python -*-
# -*- coding: utf-8 -*-
##############################################################################
@ -273,8 +273,8 @@ def _make_table_notes(
"expl_key": "Rem.",
"email": "e-mail",
"emailperso": "e-mail perso",
"signatures": "Signatures",
}
rows = []
class KeyManager(dict): # comment : key (pour regrouper les comments a la fin)
@ -437,7 +437,7 @@ def _make_table_notes(
if with_emails:
columns_ids += ["email", "emailperso"]
# Ajoute lignes en tête et moyennes
if len(evals) > 0:
if len(evals) > 0 and format != "bordereau":
rows_head = [row_coefs]
if is_apc:
rows_head.append(row_poids)
@ -465,6 +465,8 @@ def _make_table_notes(
columns_ids.append("expl_key")
elif format == "xls" or format == "xml":
columns_ids.append("comment")
elif format == "bordereau":
columns_ids.append("signatures")
# titres divers:
gl = "".join(["&group_ids%3Alist=" + str(g) for g in group_ids])
@ -480,11 +482,38 @@ def _make_table_notes(
evalname = "%s-%s" % (module.code, ndb.DateDMYtoISO(E["jour"]))
hh = "%s, %s (%d étudiants)" % (E["description"], gr_title, len(etudid_etats))
filename = scu.make_filename("notes_%s_%s" % (evalname, gr_title_filename))
caption = hh
if format == "bordereau":
hh = " %d étudiants" % (len(etudid_etats))
hh += " %d absent" % (nb_abs)
if nb_abs > 1:
hh += "s"
hh += ", %d en attente." % (nb_att)
pdf_title = "<br/> BORDEREAU DE SIGNATURES"
pdf_title += "<br/><br/>%(titre)s" % sem
pdf_title += "<br/>(%(mois_debut)s - %(mois_fin)s)" % sem
pdf_title += " semestre %s %s" % (
sem["semestre_id"],
sem.get("modalite", ""),
)
pdf_title += f"<br/>Notes du module {module.code} - {module.titre}"
pdf_title += "<br/>Evaluation : %(description)s " % e
if len(e["jour"]) > 0:
pdf_title += " (%(jour)s)" % e
pdf_title += "(noté sur %(note_max)s )<br/><br/>" % e
else:
hh = " %s, %s (%d étudiants)" % (
E["description"],
gr_title,
len(etudid_etats),
)
if len(e["jour"]) > 0:
pdf_title = "%(description)s (%(jour)s)" % e
else:
pdf_title = "%(description)s " % e
caption = hh
html_title = ""
base_url = "evaluation_listenotes?evaluation_id=%s" % E["evaluation_id"] + gl
html_next_section = (
@ -499,7 +528,7 @@ def _make_table_notes(
title += " %s" % gr_title
caption = title
html_next_section = ""
if format == "pdf":
if format == "pdf" or format == "bordereau":
caption = "" # same as pdf_title
pdf_title = title
html_title = f"""<h2 class="formsemestre">Notes {module.type_name()} <a href="{
@ -528,7 +557,8 @@ def _make_table_notes(
preferences=sco_preferences.SemPreferences(modimpl["formsemestre_id"]),
# html_generate_cells=False # la derniere ligne (moyennes) est incomplete
)
if format == "bordereau":
format = "pdf"
t = tab.make_page(format=format, with_html_headers=False)
if format != "html":
return t
@ -548,6 +578,7 @@ def _make_table_notes(
histo = histogram_notes(notes)
# 2 colonnes: histo, comments
C = [
f'<br><a class="stdlink" href="{base_url}&format=bordereau">Bordereau de Signatures (version PDF)</a>',
"<table><tr><td><div><h4>Répartition des notes:</h4>"
+ histo
+ "</div></td>\n",