Merge pull request 'Bordereau de signatures' (#194) from pascal.bouron/ScoDoc_Lyon:master into master

Reviewed-on: https://scodoc.org/git/viennet/ScoDoc/pulls/194
This commit is contained in:
Emmanuel Viennet 2021-12-06 22:56:01 +01:00
commit f2db115fdf
2 changed files with 57 additions and 22 deletions

View File

@ -1070,12 +1070,17 @@ def evaluation_describe(evaluation_id="", edit_in_place=True):
) )
else: else:
# date et absences (pas pour evals de malus) # 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"]: 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) group_id = sco_groups.get_default_group(formsemestre_id)
H.append( H.append(
f"""<span class="noprint"><a href="{url_for( f"""<span class="noprint"><a href="{url_for(
@ -1086,6 +1091,13 @@ def evaluation_describe(evaluation_id="", edit_in_place=True):
) )
}">(absences ce jour)</a></span>""" }">(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( H.append(
'</p><p>Coefficient dans le module: <b>%s</b>, notes sur <span id="eval_note_max">%g</span> ' '</p><p>Coefficient dans le module: <b>%s</b>, notes sur <span id="eval_note_max">%g</span> '
% (E["coefficient"], E["note_max"]) % (E["coefficient"], E["note_max"])

View File

@ -1,4 +1,4 @@
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## ##############################################################################
@ -271,8 +271,8 @@ def _make_table_notes(
"expl_key": "Rem.", "expl_key": "Rem.",
"email": "e-mail", "email": "e-mail",
"emailperso": "e-mail perso", "emailperso": "e-mail perso",
"signatures": "Signatures",
} }
rows = [] rows = []
class keymgr(dict): # comment : key (pour regrouper les comments a la fin) class keymgr(dict): # comment : key (pour regrouper les comments a la fin)
@ -399,7 +399,7 @@ def _make_table_notes(
if with_emails: if with_emails:
columns_ids += ["email", "emailperso"] columns_ids += ["email", "emailperso"]
# Ajoute lignes en tête et moyennes # Ajoute lignes en tête et moyennes
if len(evals) > 0: if len(evals) > 0 and format != 'bordereau':
rows = [coefs, note_max] + rows rows = [coefs, note_max] + rows
rows.append(moys) rows.append(moys)
# ajout liens HTMl vers affichage une evaluation: # ajout liens HTMl vers affichage une evaluation:
@ -423,6 +423,8 @@ def _make_table_notes(
columns_ids.append("expl_key") columns_ids.append("expl_key")
elif format == "xls" or format == "xml": elif format == "xls" or format == "xml":
columns_ids.append("comment") columns_ids.append("comment")
elif format == "bordereau":
columns_ids.append("signatures")
# titres divers: # titres divers:
gl = "".join(["&group_ids%3Alist=" + str(g) for g in group_ids]) gl = "".join(["&group_ids%3Alist=" + str(g) for g in group_ids])
@ -436,13 +438,33 @@ def _make_table_notes(
gl = "&with_emails%3Alist=yes" + gl gl = "&with_emails%3Alist=yes" + gl
if len(evals) == 1: if len(evals) == 1:
evalname = "%s-%s" % (Mod["code"], ndb.DateDMYtoISO(E["jour"])) evalname = "%s-%s" % (Mod["code"], ndb.DateDMYtoISO(E["jour"]))
hh = "%s, %s (%d étudiants)" % (E["description"], gr_title, len(etudids))
filename = scu.make_filename("notes_%s_%s" % (evalname, gr_title_filename)) filename = scu.make_filename("notes_%s_%s" % (evalname, gr_title_filename))
caption = hh
if len(e["jour"]) > 0:
pdf_title = "%(description)s (%(jour)s)" % e if format == 'bordereau':
hh = " %d étudiants" % (len(etudids))
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 += '<br/>Notes du module %(code)s - %(titre)s' % Mod
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: else:
pdf_title = "%(description)s " % e hh = " %s, %s (%d étudiants)" % (E["description"], gr_title, len(etudids))
if len(e["jour"]) > 0 :
pdf_title = "%(description)s (%(jour)s)" % e
else:
pdf_title = "%(description)s " % e
caption = hh
html_title = "" html_title = ""
base_url = "evaluation_listenotes?evaluation_id=%s" % E["evaluation_id"] + gl base_url = "evaluation_listenotes?evaluation_id=%s" % E["evaluation_id"] + gl
html_next_section = ( html_next_section = (
@ -457,7 +479,7 @@ def _make_table_notes(
title += " %s" % gr_title title += " %s" % gr_title
caption = title caption = title
html_next_section = "" html_next_section = ""
if format == "pdf": if format == "pdf" or format == "bordereau":
caption = "" # same as pdf_title caption = "" # same as pdf_title
pdf_title = title pdf_title = title
html_title = ( html_title = (
@ -485,7 +507,8 @@ def _make_table_notes(
preferences=sco_preferences.SemPreferences(M["formsemestre_id"]), preferences=sco_preferences.SemPreferences(M["formsemestre_id"]),
# html_generate_cells=False # la derniere ligne (moyennes) est incomplete # 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) t = tab.make_page(format=format, with_html_headers=False)
if format != "html": if format != "html":
return t return t
@ -504,12 +527,12 @@ def _make_table_notes(
# Une seule evaluation: ajoute histogramme # Une seule evaluation: ajoute histogramme
histo = histogram_notes(notes) histo = histogram_notes(notes)
# 2 colonnes: histo, comments # 2 colonnes: histo, comments
C = [ C = []
"<table><tr><td><div><h4>Répartition des notes:</h4>" C.append('<br><b><i>Bordereau de Signatures (version PDF)</i> </b><a href="%s&format=bordereau">%s</a>'%(base_url, scu.ICON_PDF))
+ histo C.append("<br><table><tr><td><div><h4>Répartition des notes:</h4>")
+ "</div></td>\n", C.append( histo + "</div></td>\n")
'<td style="padding-left: 50px; vertical-align: top;"><p>', C.append('<td style="padding-left: 50px; vertical-align: top;"><p>')
]
commentkeys = list(K.items()) # [ (comment, key), ... ] commentkeys = list(K.items()) # [ (comment, key), ... ]
commentkeys.sort(key=lambda x: int(x[1])) commentkeys.sort(key=lambda x: int(x[1]))
for (comment, key) in commentkeys: for (comment, key) in commentkeys:
@ -633,7 +656,7 @@ def _add_eval_columns(
titles[evaluation_id] = "%(description)s (%(jour)s)" % e titles[evaluation_id] = "%(description)s (%(jour)s)" % e
else: else:
titles[evaluation_id] = "%(description)s " % e titles[evaluation_id] = "%(description)s " % e
if e["eval_state"]["evalcomplete"]: if e["eval_state"]["evalcomplete"]:
titles["_" + str(evaluation_id) + "_td_attrs"] = 'class="eval_complete"' titles["_" + str(evaluation_id) + "_td_attrs"] = 'class="eval_complete"'
elif e["eval_state"]["evalattente"]: elif e["eval_state"]["evalattente"]: