forked from ScoDoc/ScoDoc
Améliore evaluation_listenotes + cosmetic
This commit is contained in:
parent
b26692f3cd
commit
0c3216e432
@ -63,12 +63,13 @@ def do_evaluation_listenotes(
|
|||||||
"""
|
"""
|
||||||
Affichage des notes d'une évaluation (si evaluation_id)
|
Affichage des notes d'une évaluation (si evaluation_id)
|
||||||
ou de toutes les évaluations d'un module (si moduleimpl_id)
|
ou de toutes les évaluations d'un module (si moduleimpl_id)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
mode = None
|
mode = None
|
||||||
evaluations: list[Evaluation] = []
|
evaluations: list[Evaluation] = []
|
||||||
if moduleimpl_id is not None:
|
if moduleimpl_id is not None:
|
||||||
mode = "module"
|
mode = "module"
|
||||||
modimpl = ModuleImpl.query.get_or_404(moduleimpl_id)
|
modimpl = ModuleImpl.get_modimpl(moduleimpl_id)
|
||||||
evaluations = modimpl.evaluations.all()
|
evaluations = modimpl.evaluations.all()
|
||||||
elif evaluation_id is not None:
|
elif evaluation_id is not None:
|
||||||
mode = "eval"
|
mode = "eval"
|
||||||
@ -76,11 +77,13 @@ def do_evaluation_listenotes(
|
|||||||
else:
|
else:
|
||||||
raise ValueError("missing argument: evaluation or module")
|
raise ValueError("missing argument: evaluation or module")
|
||||||
if not evaluations:
|
if not evaluations:
|
||||||
|
if fmt == "json":
|
||||||
|
return [], ""
|
||||||
return "<p>Aucune évaluation !</p>", "ScoDoc"
|
return "<p>Aucune évaluation !</p>", "ScoDoc"
|
||||||
evaluation = evaluations[0]
|
evaluation = evaluations[0]
|
||||||
modimpl = evaluation.moduleimpl # il y a au moins une evaluation
|
modimpl = evaluation.moduleimpl # il y a au moins une evaluation
|
||||||
|
|
||||||
# description de l'evaluation
|
# description de l'évaluation
|
||||||
if evaluation_id is not None:
|
if evaluation_id is not None:
|
||||||
H = [sco_evaluations.evaluation_describe(evaluation_id=evaluation_id)]
|
H = [sco_evaluations.evaluation_describe(evaluation_id=evaluation_id)]
|
||||||
page_title = f"Notes {evaluation.description or modimpl.module.code}"
|
page_title = f"Notes {evaluation.description or modimpl.module.code}"
|
||||||
@ -172,6 +175,17 @@ def do_evaluation_listenotes(
|
|||||||
"template": "%(elem)s ",
|
"template": "%(elem)s ",
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
"split_groups",
|
||||||
|
{
|
||||||
|
"input_type": "checkbox",
|
||||||
|
"title": "",
|
||||||
|
"allowed_values": ("yes",),
|
||||||
|
"labels": ("détailler les groupes",),
|
||||||
|
"attributes": ('onclick="document.tf.submit();"',),
|
||||||
|
"template": "%(elem)s ",
|
||||||
|
},
|
||||||
|
),
|
||||||
(
|
(
|
||||||
"with_emails",
|
"with_emails",
|
||||||
{
|
{
|
||||||
@ -213,6 +227,7 @@ def do_evaluation_listenotes(
|
|||||||
anonymous_listing = tf[2]["anonymous_listing"]
|
anonymous_listing = tf[2]["anonymous_listing"]
|
||||||
note_sur_20 = tf[2]["note_sur_20"]
|
note_sur_20 = tf[2]["note_sur_20"]
|
||||||
hide_groups = tf[2]["hide_groups"]
|
hide_groups = tf[2]["hide_groups"]
|
||||||
|
split_groups = tf[2]["split_groups"]
|
||||||
with_emails = tf[2]["with_emails"]
|
with_emails = tf[2]["with_emails"]
|
||||||
group_ids = [x for x in tf[2]["group_ids"] if x != ""]
|
group_ids = [x for x in tf[2]["group_ids"] if x != ""]
|
||||||
return (
|
return (
|
||||||
@ -224,6 +239,7 @@ def do_evaluation_listenotes(
|
|||||||
anonymous_listing=anonymous_listing,
|
anonymous_listing=anonymous_listing,
|
||||||
group_ids=group_ids,
|
group_ids=group_ids,
|
||||||
hide_groups=hide_groups,
|
hide_groups=hide_groups,
|
||||||
|
split_groups=split_groups,
|
||||||
with_emails=with_emails,
|
with_emails=with_emails,
|
||||||
mode=mode,
|
mode=mode,
|
||||||
),
|
),
|
||||||
@ -238,6 +254,7 @@ def _make_table_notes(
|
|||||||
note_sur_20=False,
|
note_sur_20=False,
|
||||||
anonymous_listing=False,
|
anonymous_listing=False,
|
||||||
hide_groups=False,
|
hide_groups=False,
|
||||||
|
split_groups=False,
|
||||||
with_emails=False,
|
with_emails=False,
|
||||||
group_ids: list[int] | None = None,
|
group_ids: list[int] | None = None,
|
||||||
mode="module", # "eval" or "module"
|
mode="module", # "eval" or "module"
|
||||||
@ -284,7 +301,13 @@ def _make_table_notes(
|
|||||||
columns_ids = ["etudid", "nom", "prenom"]
|
columns_ids = ["etudid", "nom", "prenom"]
|
||||||
else:
|
else:
|
||||||
columns_ids = ["nomprenom"]
|
columns_ids = ["nomprenom"]
|
||||||
if not hide_groups and fmt not in {"xml", "json"}:
|
partitions = []
|
||||||
|
if split_groups:
|
||||||
|
partitions = formsemestre.get_partitions_list(
|
||||||
|
with_default=False, only_listed=True
|
||||||
|
)
|
||||||
|
columns_ids += [f"partition_{p.id}" for p in partitions]
|
||||||
|
elif not hide_groups and fmt not in {"xml", "json"}:
|
||||||
# n'indique pas les groupes en xml et json car notation "humaine" ici
|
# n'indique pas les groupes en xml et json car notation "humaine" ici
|
||||||
columns_ids.append("group")
|
columns_ids.append("group")
|
||||||
|
|
||||||
@ -299,6 +322,7 @@ def _make_table_notes(
|
|||||||
"emailperso": "e-mail perso",
|
"emailperso": "e-mail perso",
|
||||||
"signatures": "Signatures",
|
"signatures": "Signatures",
|
||||||
}
|
}
|
||||||
|
titles.update({f"partition_{p.id}": p.partition_name or "" for p in partitions})
|
||||||
rows = []
|
rows = []
|
||||||
|
|
||||||
class KeyManager(dict):
|
class KeyManager(dict):
|
||||||
@ -339,41 +363,46 @@ def _make_table_notes(
|
|||||||
if etat == scu.INSCRIT: # si inscrit, indique groupe
|
if etat == scu.INSCRIT: # si inscrit, indique groupe
|
||||||
groups = sco_groups.get_etud_groups(etudid, formsemestre.id)
|
groups = sco_groups.get_etud_groups(etudid, formsemestre.id)
|
||||||
grc = sco_groups.listgroups_abbrev(groups)
|
grc = sco_groups.listgroups_abbrev(groups)
|
||||||
|
groups_cols = {
|
||||||
|
f"partition_{p.id}": p.get_etud_group(etudid).group_name or ""
|
||||||
|
for p in partitions
|
||||||
|
}
|
||||||
else:
|
else:
|
||||||
if etat == scu.DEMISSION:
|
if etat == scu.DEMISSION:
|
||||||
grc = "DEM" # attention: ce code est re-ecrit plus bas, ne pas le changer (?)
|
grc = "DEM" # attention: ce code est re-ecrit plus bas, ne pas le changer (?)
|
||||||
css_row_class = "etuddem"
|
css_row_class = "etuddem"
|
||||||
else:
|
else:
|
||||||
grc = etat
|
grc = etat
|
||||||
|
groups_cols = {f"partition_{p.id}": etat for p in partitions}
|
||||||
|
|
||||||
code = getattr(etud, anonymous_lst_key)
|
code = getattr(etud, anonymous_lst_key)
|
||||||
if not code: # laisser le code vide n'aurait aucun sens, prenons l'etudid
|
if not code: # laisser le code vide n'aurait aucun sens, prenons l'etudid
|
||||||
code = etudid
|
code = etudid
|
||||||
|
|
||||||
rows.append(
|
row = {
|
||||||
{
|
"code": str(code), # INE, NIP ou etudid
|
||||||
"code": str(code), # INE, NIP ou etudid
|
"_code_td_attrs": 'style="padding-left: 1em; padding-right: 2em;"',
|
||||||
"_code_td_attrs": 'style="padding-left: 1em; padding-right: 2em;"',
|
"etudid": etudid,
|
||||||
"etudid": etudid,
|
"nom": etud.nom.upper(),
|
||||||
"nom": etud.nom.upper(),
|
"_nomprenom_target": url_for(
|
||||||
"_nomprenom_target": url_for(
|
"notes.formsemestre_bulletinetud",
|
||||||
"notes.formsemestre_bulletinetud",
|
scodoc_dept=g.scodoc_dept,
|
||||||
scodoc_dept=g.scodoc_dept,
|
formsemestre_id=formsemestre.id,
|
||||||
formsemestre_id=formsemestre.id,
|
etudid=etudid,
|
||||||
etudid=etudid,
|
),
|
||||||
),
|
"_nomprenom_td_attrs": f"""id="{etudid}" class="etudinfo" data-sort="{
|
||||||
"_nomprenom_td_attrs": f"""id="{etudid}" class="etudinfo" data-sort="{
|
|
||||||
etud.sort_key}" """,
|
etud.sort_key}" """,
|
||||||
"prenom": etud.prenom.lower().capitalize(),
|
"prenom": etud.prenom.lower().capitalize(),
|
||||||
"nom_usuel": etud.nom_usuel,
|
"nom_usuel": etud.nom_usuel,
|
||||||
"nomprenom": etud.nomprenom,
|
"nomprenom": etud.nomprenom,
|
||||||
"group": grc,
|
"group": grc,
|
||||||
"_group_td_attrs": 'class="group"',
|
"_group_td_attrs": 'class="group"',
|
||||||
"email": etud.get_first_email(),
|
"email": etud.get_first_email(),
|
||||||
"emailperso": etud.get_first_email("emailperso"),
|
"emailperso": etud.get_first_email("emailperso"),
|
||||||
"_css_row_class": css_row_class or "",
|
"_css_row_class": css_row_class or "",
|
||||||
}
|
}
|
||||||
)
|
row.update(groups_cols)
|
||||||
|
rows.append(row)
|
||||||
|
|
||||||
# Lignes en tête:
|
# Lignes en tête:
|
||||||
row_coefs = {
|
row_coefs = {
|
||||||
@ -517,6 +546,8 @@ def _make_table_notes(
|
|||||||
gl = "&anonymous_listing%3Alist=yes" + gl
|
gl = "&anonymous_listing%3Alist=yes" + gl
|
||||||
if hide_groups:
|
if hide_groups:
|
||||||
gl = "&hide_groups%3Alist=yes" + gl
|
gl = "&hide_groups%3Alist=yes" + gl
|
||||||
|
if split_groups:
|
||||||
|
gl = "&split_groups%3Alist=yes" + gl
|
||||||
if with_emails:
|
if with_emails:
|
||||||
gl = "&with_emails%3Alist=yes" + gl
|
gl = "&with_emails%3Alist=yes" + gl
|
||||||
if len(evaluations) == 1:
|
if len(evaluations) == 1:
|
||||||
@ -573,7 +604,7 @@ def _make_table_notes(
|
|||||||
title = f"Notes {module.type_name()} {module.code} {module.titre}"
|
title = f"Notes {module.type_name()} {module.code} {module.titre}"
|
||||||
title += f""" semestre {formsemestre.titre_mois()}"""
|
title += f""" semestre {formsemestre.titre_mois()}"""
|
||||||
if gr_title and gr_title != "tous":
|
if gr_title and gr_title != "tous":
|
||||||
title += " {gr_title}"
|
title += f" {gr_title}"
|
||||||
caption = title
|
caption = title
|
||||||
html_next_section = ""
|
html_next_section = ""
|
||||||
if fmt == "pdf" or fmt == "bordereau":
|
if fmt == "pdf" or fmt == "bordereau":
|
||||||
|
@ -446,7 +446,8 @@ textarea {
|
|||||||
*/
|
*/
|
||||||
@media (min-width: 769px) {
|
@media (min-width: 769px) {
|
||||||
.form-group input[type="submit"] {
|
.form-group input[type="submit"] {
|
||||||
width: 192px;
|
min-width: 192px;
|
||||||
|
width: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
<label class="edition">
|
<label class="edition">
|
||||||
<input type="checkbox" autocomplete="off" id="inputModif"
|
<input type="checkbox" autocomplete="off" id="inputModif"
|
||||||
{% if edit_partition %}checked{% endif %}>
|
{% if edit_partition %}checked{% endif %}>
|
||||||
Modifier les partitions et groupes
|
Créer ou modifier partitions et groupes
|
||||||
</label>
|
</label>
|
||||||
<div class="filtres"></div>
|
<div class="filtres"></div>
|
||||||
<div style="display: flex; justify-content: space-between;">
|
<div style="display: flex; justify-content: space-between;">
|
||||||
|
@ -1755,26 +1755,29 @@ def evaluation_create(moduleimpl_id):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/evaluation_listenotes", methods=["GET", "POST"]) # API ScoDoc 7 compat
|
@bp.route("/evaluation_listenotes")
|
||||||
@scodoc
|
@scodoc
|
||||||
@permission_required_compat_scodoc7(Permission.ScoView)
|
@permission_required_compat_scodoc7(Permission.ScoView)
|
||||||
@scodoc7func
|
|
||||||
def evaluation_listenotes():
|
def evaluation_listenotes():
|
||||||
"""Affichage des notes d'une évaluation.
|
"""Affichage des notes d'une évaluation.
|
||||||
Si evaluation_id non spécifié, toutes les notes des évaluations de ce modimpl.
|
Args:
|
||||||
|
- evaluation_id (une seule éval)
|
||||||
|
- ou moduleimpl_id (toutes les évals du module)
|
||||||
|
- group_ids: groupes à lister
|
||||||
|
- fmt : html, xls, pdf, json
|
||||||
"""
|
"""
|
||||||
evaluation_id = None
|
# Arguments
|
||||||
moduleimpl_id = None
|
evaluation_id = request.args.get("evaluation_id")
|
||||||
vals = scu.get_request_args()
|
moduleimpl_id = request.args.get("moduleimpl_id")
|
||||||
try:
|
try:
|
||||||
if "evaluation_id" in vals:
|
if evaluation_id is not None:
|
||||||
evaluation_id = int(vals["evaluation_id"])
|
evaluation_id = int(evaluation_id)
|
||||||
if "moduleimpl_id" in vals and vals["moduleimpl_id"]:
|
if moduleimpl_id is not None:
|
||||||
moduleimpl_id = int(vals["moduleimpl_id"])
|
moduleimpl_id = int(moduleimpl_id)
|
||||||
except ValueError as exc:
|
except ValueError as exc:
|
||||||
raise ScoValueError("evaluation_listenotes: id invalides !") from exc
|
raise ScoValueError("evaluation_listenotes: id invalides !") from exc
|
||||||
|
fmt = request.args.get("fmt", "html")
|
||||||
fmt = vals.get("fmt", "html")
|
#
|
||||||
content, page_title = sco_liste_notes.do_evaluation_listenotes(
|
content, page_title = sco_liste_notes.do_evaluation_listenotes(
|
||||||
evaluation_id=evaluation_id, moduleimpl_id=moduleimpl_id, fmt=fmt
|
evaluation_id=evaluation_id, moduleimpl_id=moduleimpl_id, fmt=fmt
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user