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:
# 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(
@ -1086,6 +1091,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 -*-
##############################################################################
@ -271,8 +271,8 @@ def _make_table_notes(
"expl_key": "Rem.",
"email": "e-mail",
"emailperso": "e-mail perso",
"signatures": "Signatures",
}
rows = []
class keymgr(dict): # comment : key (pour regrouper les comments a la fin)
@ -399,7 +399,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 = [coefs, note_max] + rows
rows.append(moys)
# ajout liens HTMl vers affichage une evaluation:
@ -423,6 +423,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])
@ -436,13 +438,33 @@ def _make_table_notes(
gl = "&with_emails%3Alist=yes" + gl
if len(evals) == 1:
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))
caption = hh
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:
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 = ""
base_url = "evaluation_listenotes?evaluation_id=%s" % E["evaluation_id"] + gl
html_next_section = (
@ -457,7 +479,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 = (
@ -485,7 +507,8 @@ def _make_table_notes(
preferences=sco_preferences.SemPreferences(M["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
@ -504,12 +527,12 @@ def _make_table_notes(
# Une seule evaluation: ajoute histogramme
histo = histogram_notes(notes)
# 2 colonnes: histo, comments
C = [
"<table><tr><td><div><h4>Répartition des notes:</h4>"
+ histo
+ "</div></td>\n",
'<td style="padding-left: 50px; vertical-align: top;"><p>',
]
C = []
C.append('<br><b><i>Bordereau de Signatures (version PDF)</i> </b><a href="%s&format=bordereau">%s</a>'%(base_url, scu.ICON_PDF))
C.append("<br><table><tr><td><div><h4>Répartition des notes:</h4>")
C.append( histo + "</div></td>\n")
C.append('<td style="padding-left: 50px; vertical-align: top;"><p>')
commentkeys = list(K.items()) # [ (comment, key), ... ]
commentkeys.sort(key=lambda x: int(x[1]))
for (comment, key) in commentkeys: