Option to show emails in marks listings

This commit is contained in:
viennet 2020-10-06 12:13:04 +02:00
parent b4e1b0a955
commit a934542537
1 changed files with 26 additions and 3 deletions

View File

@ -137,6 +137,17 @@ def do_evaluation_listenotes(context, REQUEST):
"template": '<tr><td class="tf-fieldlabel">%(label)s</td><td class="tf-field">%(elem)s &nbsp;&nbsp;',
},
),
(
"note_sur_20",
{
"input_type": "checkbox",
"title": "",
"allowed_values": ("yes",),
"labels": ("notes sur 20",),
"attributes": ('onclick="document.tf.submit();"',),
"template": "%(elem)s &nbsp;&nbsp;",
},
),
(
"hide_groups",
{
@ -149,12 +160,12 @@ def do_evaluation_listenotes(context, REQUEST):
},
),
(
"note_sur_20",
"with_emails",
{
"input_type": "checkbox",
"title": "",
"allowed_values": ("yes",),
"labels": ("notes sur 20",),
"labels": ("montrer les e-mails",),
"attributes": ('onclick="document.tf.submit();"',),
"template": "%(elem)s</td></tr>",
},
@ -183,6 +194,7 @@ def do_evaluation_listenotes(context, REQUEST):
anonymous_listing = tf[2]["anonymous_listing"]
note_sur_20 = tf[2]["note_sur_20"]
hide_groups = tf[2]["hide_groups"]
with_emails = tf[2]["with_emails"]
return _make_table_notes(
context,
REQUEST,
@ -193,6 +205,7 @@ def do_evaluation_listenotes(context, REQUEST):
anonymous_listing=anonymous_listing,
group_ids=tf[2]["group_ids"],
hide_groups=hide_groups,
with_emails=with_emails,
)
@ -205,6 +218,7 @@ def _make_table_notes(
note_sur_20=False,
anonymous_listing=False,
hide_groups=False,
with_emails=False,
group_ids=[],
):
"""Generate table for evaluations marks"""
@ -253,6 +267,8 @@ def _make_table_notes(
"prenom": "Prénom",
"nomprenom": "Nom",
"expl_key": "Rem.",
"email" : "e-mail",
"emailperso" : "e-mail perso"
}
rows = []
@ -307,6 +323,8 @@ def _make_table_notes(
"prenom": strcapitalize(strlower(etud["prenom"])),
"nomprenom": etud["nomprenom"],
"group": grc,
"email" : etud["email"],
"emailperso" : etud["emailperso"],
"_css_row_class": css_row_class or "",
}
)
@ -377,7 +395,10 @@ def _make_table_notes(
)
columns_ids.append("moymod")
# ajoute lignes en tête et moyennes
# Ajoute colonnes emails tout à droite:
if with_emails:
columns_ids += [ "email", "emailperso" ]
# Ajoute lignes en tête et moyennes
if len(evals) > 0:
rows = [coefs, note_max] + rows
rows.append(moys)
@ -409,6 +430,8 @@ def _make_table_notes(
gl = "&amp;anonymous_listing%3Alist=yes" + gl
if hide_groups:
gl = "&amp;hide_groups%3Alist=yes" + gl
if with_emails:
gl = "&amp;with_emails%3Alist=yes" + gl
if len(evals) == 1:
evalname = "%s-%s" % (Mod["code"], DateDMYtoISO(E["jour"]))
hh = "%s, %s (%d étudiants)" % (E["description"], gr_title, len(etudids))