From 5103f162a7e42257a6c48c38180c74f603a7e732 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 27 Mar 2023 18:30:36 +0200 Subject: [PATCH] =?UTF-8?q?Am=C3=A9liore=20page=20inscriptions=20UEs=20BUT?= =?UTF-8?q?:=20indique=20parcours.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/groups.py | 9 ++++ app/scodoc/sco_moduleimpl_inscriptions.py | 45 ++++++++++++++----- app/static/css/scodoc.css | 11 +++++ .../js/moduleimpl_inscriptions_stats.js | 22 ++++++++- 4 files changed, 76 insertions(+), 11 deletions(-) diff --git a/app/models/groups.py b/app/models/groups.py index b30d1b4db6..1920b3e923 100644 --- a/app/models/groups.py +++ b/app/models/groups.py @@ -99,6 +99,15 @@ class Partition(db.Model): } return d + def get_etud_group(self, etudid: int) -> "GroupDescr": + "Le groupe de l'étudiant dans cette partition, ou None si pas présent" + return ( + GroupDescr.query.filter_by(partition_id=self.id) + .join(group_membership) + .filter_by(etudid=etudid) + .first() + ) + class GroupDescr(db.Model): """Description d'un groupe d'une partition""" diff --git a/app/scodoc/sco_moduleimpl_inscriptions.py b/app/scodoc/sco_moduleimpl_inscriptions.py index 196051b099..4c593c06d0 100644 --- a/app/scodoc/sco_moduleimpl_inscriptions.py +++ b/app/scodoc/sco_moduleimpl_inscriptions.py @@ -36,7 +36,13 @@ from flask_login import current_user from app.comp import res_sem from app.comp.res_compat import NotesTableCompat -from app.models import FormSemestre, Identite, ScolarFormSemestreValidation, UniteEns +from app.models import ( + FormSemestre, + Identite, + Partition, + ScolarFormSemestreValidation, + UniteEns, +) from app import log from app.tables import list_etuds @@ -517,11 +523,23 @@ def _list_but_ue_inscriptions(res: NotesTableCompat, read_only: bool = True) -> (UniteEns.query.get(ue_id) for ue_id in ue_ids), key=lambda u: (u.numero or 0, u.acronyme), ) - H.append("""""") + H.append( + """
+ + + """ + ) for ue in ues: H.append(f"""""") - H.append("""""") - + H.append( + """ + + + """ + ) + partition_parcours: Partition = Partition.query.filter_by( + formsemestre=res.formsemestre, partition_name=scu.PARTITION_PARCOURS + ).first() etuds = list_etuds.etuds_sorted_from_ids(table_inscr.keys()) for etud in etuds: ues_etud = table_inscr[etud.id] @@ -534,6 +552,11 @@ def _list_but_ue_inscriptions(res: NotesTableCompat, read_only: bool = True) -> )}" >{etud.nomprenom}""" ) + # Parcours: + group = partition_parcours.get_etud_group(etud.id) + parcours_name = group.group_name if group else "" + H.append(f"""""") + # UEs: for ue in ues: td_class = "" est_inscr = ues_etud.get(ue.id) # None si pas concerné @@ -568,24 +591,26 @@ def _list_but_ue_inscriptions(res: NotesTableCompat, read_only: bool = True) -> content = f""" """ H.append(f"""{content}""") H.append( - """
NomParcours{ue.acronyme}
{parcours_name}
+ """ + +
L'inscription ou désinscription aux UEs du BUT n'affecte pas les inscriptions aux modules diff --git a/app/static/css/scodoc.css b/app/static/css/scodoc.css index d4674f3c2b..1129225d71 100644 --- a/app/static/css/scodoc.css +++ b/app/static/css/scodoc.css @@ -2066,6 +2066,17 @@ form.list_but_ue_inscriptions td { text-align: center; } + +table#but_ue_inscriptions { + margin-left: 16px; + width: auto; +} + +div#but_ue_inscriptions_filter { + margin-left: 16px; + margin-bottom: 8px; +} + /* Formulaire edition des partitions */ form#editpart table { border: 1px solid gray; diff --git a/app/static/js/moduleimpl_inscriptions_stats.js b/app/static/js/moduleimpl_inscriptions_stats.js index 4686bd8523..af8d4bb3cb 100644 --- a/app/static/js/moduleimpl_inscriptions_stats.js +++ b/app/static/js/moduleimpl_inscriptions_stats.js @@ -14,4 +14,24 @@ function change_ue_inscr(elt) { sco_message("changement inscription UE enregistré"); } ); -} \ No newline at end of file +} + +$(function () { + $("table#but_ue_inscriptions").DataTable( + { + paging: false, + searching: true, + info: false, + autoWidth: false, + fixedHeader: { + header: true, + footer: false + }, + orderCellsTop: true, // cellules ligne 1 pour tri + aaSorting: [], // Prevent initial sorting + "oLanguage": { + "sSearch": "Chercher :" + } + } + ); +});