From 3bf36c111925b67c1590efce12c120822cf78c6f Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 19 Sep 2023 21:39:36 +0200 Subject: [PATCH] =?UTF-8?q?formsemestre=5Fstatus:=20refonte=20cadre=20grou?= =?UTF-8?q?pes/assiduit=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/formsemestre.py | 9 ++ app/scodoc/sco_formsemestre_status.py | 180 ++++++++++++++------------ app/scodoc/sco_groups.py | 1 + app/static/css/scodoc.css | 62 ++++++--- sco_version.py | 2 +- 5 files changed, 151 insertions(+), 103 deletions(-) diff --git a/app/models/formsemestre.py b/app/models/formsemestre.py index 8edc88a3..35385729 100644 --- a/app/models/formsemestre.py +++ b/app/models/formsemestre.py @@ -771,6 +771,15 @@ class FormSemestre(db.Model): etuds.sort(key=lambda e: e.sort_key) return etuds + def get_partitions_list(self, with_default=True) -> list[Partition]: + """Liste des partitions pour ce semestre (list of dicts), + triées par numéro, avec la partition par défaut en fin de liste. + """ + partitions = [p for p in self.partitions if p.partition_name is not None] + if with_default: + partitions += [p for p in partitions if p.partition_name is None] + return partitions + @cached_property def etudids_actifs(self) -> set: "Set des etudids inscrits non démissionnaires et non défaillants" diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index 2b00158f..260ba77d 100755 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -818,101 +818,113 @@ def _make_listes_sem(formsemestre: FormSemestre) -> str: can_edit_abs = current_user.has_permission(Permission.ScoAbsChange) # H.append( - f"""

Listes de {formsemestre.titre} - ({formsemestre.mois_debut()} - {formsemestre.mois_fin()})

""" + f"""

Groupes et absences de {formsemestre.titre} + ({ + formsemestre.mois_debut()} - {formsemestre.mois_fin() + })

""" ) - - form_abs_tmpl = f""" - - - - """ - - if can_edit_abs: - form_abs_tmpl += f""" - - - - - - - - - """ - form_abs_tmpl += "" # - H.append('
') + H.append('
') # Genere liste pour chaque partition (categorie de groupes) - for partition in sco_groups.get_partitions_list(formsemestre.id): - if not partition["partition_name"]: - H.append("

Tous les étudiants

") - else: - H.append(f"""

Groupes de {partition["partition_name"]}

""") - partition_is_empty = True - groups = sco_groups.get_partition_groups(partition) + for partition in formsemestre.get_partitions_list(): + groups = partition.groups.all() + effectifs = {g.id: g.etuds.count() for g in groups} + partition_is_empty = sum(effectifs.values()) == 0 + H.append( + f""" +
+
{ + 'Groupes de ' + partition.partition_name + if partition.partition_name else + 'Tous les étudiants'} +
+
{ + "Gestion de l'assiduité" if not partition_is_empty else "" + }
+ """ + ) if groups: - H.append("") for group in groups: - n_members = len(sco_groups.get_group_members(group["group_id"])) + n_members = effectifs[group.id] if n_members == 0: continue # skip empty groups partition_is_empty = False - group["url_etat"] = url_for( - "assiduites.visu_assi_group", - scodoc_dept=g.scodoc_dept, - group_ids=group["id"], - date_debut=formsemestre.date_debut.isoformat(), - date_fin=formsemestre.date_fin.isoformat(), - ) - if group["group_name"]: - group["label"] = "groupe %(group_name)s" % group - else: - group["label"] = "liste" + group_label = f"{group.group_name}" if group.group_name else "liste" H.append( f""" - - - + +
+ """ ) + if can_edit_abs: + H.append( + f""" + + + + + """ + ) - H.append(form_abs_tmpl % group) - - H.append("
") - H.append("
") + H.append("
") # /sem-groups-assi if partition_is_empty: - H.append('

Aucun groupe peuplé dans cette partition') + H.append( + '

Aucun groupe peuplé dans cette partition' + ) if formsemestre.can_change_groups(): H.append( f""" ( str: edit_partition=1) }" class="stdlink">créer)""" ) - H.append("

") + H.append("
") + H.append("
") # /sem-groups-partition + if formsemestre.can_change_groups(): H.append( f"""

', + '
', _make_listes_sem(formsemestre), "
", ] diff --git a/app/scodoc/sco_groups.py b/app/scodoc/sco_groups.py index d2df8a21..8511ca69 100644 --- a/app/scodoc/sco_groups.py +++ b/app/scodoc/sco_groups.py @@ -131,6 +131,7 @@ def get_partition(partition_id): # OBSOLETE def get_partitions_list(formsemestre_id, with_default=True) -> list[dict]: """Liste des partitions pour ce semestre (list of dicts), triées par numéro, avec la partition par défaut en fin de liste. + OBSOLETE: utiliser FormSemestre.get_partitions_list """ partitions = ndb.SimpleDictFetch( """SELECT p.id AS partition_id, p.* diff --git a/app/static/css/scodoc.css b/app/static/css/scodoc.css index 05107dc4..b5332b97 100644 --- a/app/static/css/scodoc.css +++ b/app/static/css/scodoc.css @@ -985,17 +985,6 @@ span.linktitresem a:visited { color: red; } -.listegroupelink a:link { - color: blue; -} - -.listegroupelink a:visited { - color: blue; -} - -.listegroupelink a:hover { - color: red; -} a.stdlink, a.stdlink:visited { @@ -1792,10 +1781,6 @@ td.formsemestre_status_inscrits { text-align: center; } -div.formsemestre_status button { - margin-left: 12px;; -} - td.rcp_titre_sem a.jury_link { margin-left: 8px; color: red; @@ -1857,15 +1842,54 @@ ul.ue_inscr_list li.etud { margin-bottom: 5px; } -#grouplists h4 { +.sem-groups-abs { + background-color: rgb(137,137,137); + border-radius: 16px; + padding: 16px; + width: fit-content; +} +.sem-groups-abs h4 { font-style: italic; margin-bottom: 0px; margin-top: 5px; } -#grouplists table { - /*border: 1px solid black;*/ - border-spacing: 1px; +.sem-groups-partition-titre { + margin-left: 4px; + font-size: 110%; +} +.sem-groups-partition { + background-color: rgb(213,203,183); + border-radius: 12px; + margin-bottom: 8px; + padding: 12px; + display: grid; + grid-template-columns: 240px auto; +} + +.sem-groups-list, .sem-groups-assi { + background-color: white; + border-radius: 6px; + margin: 4px; +} + +.sem-groups-list > div { + margin: 4px; +} +.sem-groups-assi > div { + margin: 6px 8px 6px 8px; +} + +.sem-groups-assi { + display: flex; + flex-direction: row; + justify-content: flex-start; + flex-wrap: wrap; + align-items: center; +} + +.sem-groups-none { + grid-column: 1 / span 2; } /* Tableau de bord module */ diff --git a/sco_version.py b/sco_version.py index 06e12ea9..56bc64b5 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.6.30" +SCOVERSION = "9.6.31" SCONAME = "ScoDoc"