diff --git a/app/scodoc/sco_liste_notes.py b/app/scodoc/sco_liste_notes.py index c71238ee..fda6e0d8 100644 --- a/app/scodoc/sco_liste_notes.py +++ b/app/scodoc/sco_liste_notes.py @@ -63,12 +63,13 @@ def do_evaluation_listenotes( """ Affichage des notes d'une évaluation (si evaluation_id) ou de toutes les évaluations d'un module (si moduleimpl_id) + """ mode = None evaluations: list[Evaluation] = [] if moduleimpl_id is not None: mode = "module" - modimpl = ModuleImpl.query.get_or_404(moduleimpl_id) + modimpl = ModuleImpl.get_modimpl(moduleimpl_id) evaluations = modimpl.evaluations.all() elif evaluation_id is not None: mode = "eval" @@ -76,11 +77,13 @@ def do_evaluation_listenotes( else: raise ValueError("missing argument: evaluation or module") if not evaluations: + if fmt == "json": + return [], "" return "
Aucune évaluation !
", "ScoDoc" evaluation = evaluations[0] modimpl = evaluation.moduleimpl # il y a au moins une evaluation - # description de l'evaluation + # description de l'évaluation if evaluation_id is not None: H = [sco_evaluations.evaluation_describe(evaluation_id=evaluation_id)] page_title = f"Notes {evaluation.description or modimpl.module.code}" @@ -172,6 +175,17 @@ def do_evaluation_listenotes( "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", { @@ -213,6 +227,7 @@ def do_evaluation_listenotes( anonymous_listing = tf[2]["anonymous_listing"] note_sur_20 = tf[2]["note_sur_20"] hide_groups = tf[2]["hide_groups"] + split_groups = tf[2]["split_groups"] with_emails = tf[2]["with_emails"] group_ids = [x for x in tf[2]["group_ids"] if x != ""] return ( @@ -224,6 +239,7 @@ def do_evaluation_listenotes( anonymous_listing=anonymous_listing, group_ids=group_ids, hide_groups=hide_groups, + split_groups=split_groups, with_emails=with_emails, mode=mode, ), @@ -238,6 +254,7 @@ def _make_table_notes( note_sur_20=False, anonymous_listing=False, hide_groups=False, + split_groups=False, with_emails=False, group_ids: list[int] | None = None, mode="module", # "eval" or "module" @@ -284,7 +301,13 @@ def _make_table_notes( columns_ids = ["etudid", "nom", "prenom"] else: 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 columns_ids.append("group") @@ -299,6 +322,7 @@ def _make_table_notes( "emailperso": "e-mail perso", "signatures": "Signatures", } + titles.update({f"partition_{p.id}": p.partition_name or "" for p in partitions}) rows = [] class KeyManager(dict): @@ -339,41 +363,46 @@ def _make_table_notes( if etat == scu.INSCRIT: # si inscrit, indique groupe groups = sco_groups.get_etud_groups(etudid, formsemestre.id) 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: if etat == scu.DEMISSION: grc = "DEM" # attention: ce code est re-ecrit plus bas, ne pas le changer (?) css_row_class = "etuddem" else: grc = etat + groups_cols = {f"partition_{p.id}": etat for p in partitions} code = getattr(etud, anonymous_lst_key) if not code: # laisser le code vide n'aurait aucun sens, prenons l'etudid code = etudid - rows.append( - { - "code": str(code), # INE, NIP ou etudid - "_code_td_attrs": 'style="padding-left: 1em; padding-right: 2em;"', - "etudid": etudid, - "nom": etud.nom.upper(), - "_nomprenom_target": url_for( - "notes.formsemestre_bulletinetud", - scodoc_dept=g.scodoc_dept, - formsemestre_id=formsemestre.id, - etudid=etudid, - ), - "_nomprenom_td_attrs": f"""id="{etudid}" class="etudinfo" data-sort="{ + row = { + "code": str(code), # INE, NIP ou etudid + "_code_td_attrs": 'style="padding-left: 1em; padding-right: 2em;"', + "etudid": etudid, + "nom": etud.nom.upper(), + "_nomprenom_target": url_for( + "notes.formsemestre_bulletinetud", + scodoc_dept=g.scodoc_dept, + formsemestre_id=formsemestre.id, + etudid=etudid, + ), + "_nomprenom_td_attrs": f"""id="{etudid}" class="etudinfo" data-sort="{ etud.sort_key}" """, - "prenom": etud.prenom.lower().capitalize(), - "nom_usuel": etud.nom_usuel, - "nomprenom": etud.nomprenom, - "group": grc, - "_group_td_attrs": 'class="group"', - "email": etud.get_first_email(), - "emailperso": etud.get_first_email("emailperso"), - "_css_row_class": css_row_class or "", - } - ) + "prenom": etud.prenom.lower().capitalize(), + "nom_usuel": etud.nom_usuel, + "nomprenom": etud.nomprenom, + "group": grc, + "_group_td_attrs": 'class="group"', + "email": etud.get_first_email(), + "emailperso": etud.get_first_email("emailperso"), + "_css_row_class": css_row_class or "", + } + row.update(groups_cols) + rows.append(row) # Lignes en tête: row_coefs = { @@ -517,6 +546,8 @@ def _make_table_notes( gl = "&anonymous_listing%3Alist=yes" + gl if hide_groups: gl = "&hide_groups%3Alist=yes" + gl + if split_groups: + gl = "&split_groups%3Alist=yes" + gl if with_emails: gl = "&with_emails%3Alist=yes" + gl if len(evaluations) == 1: @@ -573,7 +604,7 @@ def _make_table_notes( title = f"Notes {module.type_name()} {module.code} {module.titre}" title += f""" semestre {formsemestre.titre_mois()}""" if gr_title and gr_title != "tous": - title += " {gr_title}" + title += f" {gr_title}" caption = title html_next_section = "" if fmt == "pdf" or fmt == "bordereau": diff --git a/app/static/css/scodoc97.css b/app/static/css/scodoc97.css index 43dd369f..ed06fb6d 100644 --- a/app/static/css/scodoc97.css +++ b/app/static/css/scodoc97.css @@ -446,7 +446,8 @@ textarea { */ @media (min-width: 769px) { .form-group input[type="submit"] { - width: 192px; + min-width: 192px; + width: auto; } } diff --git a/app/templates/scolar/partition_editor.j2 b/app/templates/scolar/partition_editor.j2 index 68afc2a3..70ad81bb 100644 --- a/app/templates/scolar/partition_editor.j2 +++ b/app/templates/scolar/partition_editor.j2 @@ -36,7 +36,7 @@