From 72c66961516692fd1b16895bbf5cd2daa83f0abc Mon Sep 17 00:00:00 2001 From: Iziram Date: Tue, 9 Jul 2024 15:23:36 +0200 Subject: [PATCH] =?UTF-8?q?Assiduit=C3=A9=20:=20non=20affichage=20si=20pr?= =?UTF-8?q?=C3=A9f=C3=A9rence?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_formsemestre_status.py | 30 +++++++++++++++----- app/scodoc/sco_groups_view.py | 40 +++++++++++++++++++-------- app/scodoc/sco_moduleimpl_status.py | 27 ++++++++++++++---- app/static/css/scodoc.css | 4 +++ 4 files changed, 76 insertions(+), 25 deletions(-) diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index 4c3748f4..3fb89f5f 100755 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -61,6 +61,7 @@ from app.scodoc.sco_utils import ModuleType from app.scodoc import html_sco_header from app.scodoc import htmlutils from app.scodoc import sco_archives_formsemestre +from app.scodoc import sco_assiduites as scass from app.scodoc import sco_bulletins from app.scodoc import codes_cursus from app.scodoc import sco_compute_moy @@ -783,6 +784,10 @@ def _make_listes_sem(formsemestre: FormSemestre) -> str: ) # H.append('
') + + disable_abs: str | bool = scass.has_assiduites_disable_pref(formsemestre) + show_abs: str = "hidden" if disable_abs else "" + # Genere liste pour chaque partition (categorie de groupes) for partition in formsemestre.get_partitions_list(): groups = partition.groups.all() @@ -797,10 +802,11 @@ def _make_listes_sem(formsemestre: FormSemestre) -> str: ('aucun étudiant inscrit' if partition_is_empty else 'Tous les étudiants')}
{ - "Assiduité" if not partition_is_empty else "" + "Assiduité" if not partition_is_empty and not show_abs else "" }
""" ) + if groups: for group in groups: n_members = effectifs[group.id] @@ -821,8 +827,7 @@ def _make_listes_sem(formsemestre: FormSemestre) -> str: - {n_members} étudiants -
- +
""" ) if can_edit_abs: @@ -911,7 +916,7 @@ def _make_listes_sem(formsemestre: FormSemestre) -> str: ) # --- Formulaire importation Assiduité excel (si autorisé) - if current_user.has_permission(Permission.AbsChange): + if current_user.has_permission(Permission.AbsChange) and not disable_abs: H.append( f"""

") + + if disable_abs: + H.append(f""" +

+ """) + return "\n".join(H) diff --git a/app/scodoc/sco_groups_view.py b/app/scodoc/sco_groups_view.py index e7858f8f..87ba50e6 100644 --- a/app/scodoc/sco_groups_view.py +++ b/app/scodoc/sco_groups_view.py @@ -42,6 +42,7 @@ from app import db from app.models import FormSemestre, Identite import app.scodoc.sco_utils as scu from app.scodoc import html_sco_header +from app.scodoc import sco_assiduites as scass from app.scodoc import sco_excel from app.scodoc import sco_formsemestre from app.scodoc import sco_groups @@ -894,25 +895,40 @@ def tab_absences_html(groups_infos, etat=None): group_ids: str = ",".join(map(str, groups_infos.group_ids)) formsemestre: FormSemestre = groups_infos.get_formsemestre() + disable_abs: str | bool = scass.has_assiduites_disable_pref(formsemestre) - H.extend( - [ - "

Assiduité

", - '
", + "", + ] + + if disable_abs: + liens_abs = [ + f""" +
+

La gestion des absences est désactivée dans ScoDoc pour ce semestre:

+

{disable_abs}

+
+ """ + ] + + H.extend( + [ + "

Assiduité

", + *liens_abs, "

Feuilles

", '
    ', """
  • Feuille d'émargement %s (Excel)
  • """ diff --git a/app/scodoc/sco_moduleimpl_status.py b/app/scodoc/sco_moduleimpl_status.py index 87e8fc43..470be3e8 100644 --- a/app/scodoc/sco_moduleimpl_status.py +++ b/app/scodoc/sco_moduleimpl_status.py @@ -40,6 +40,7 @@ from app.comp.res_common import ResultatsSemestre from app.comp.res_compat import NotesTableCompat from app.models import Evaluation, FormSemestre, Module, ModuleImpl, UniteEns import app.scodoc.sco_utils as scu +from app.scodoc import sco_assiduites as scass from app.scodoc.codes_cursus import UE_SPORT from app.scodoc.sco_exceptions import ScoInvalidIdType from app.scodoc.sco_cursus_dut import formsemestre_has_decisions @@ -68,6 +69,9 @@ def moduleimpl_evaluation_menu(evaluation: Evaluation, nbnotes: int = 0) -> str: else: sup_label = "Supprimer évaluation" + formsemestre: FormSemestre = FormSemestre.get_formsemestre(modimpl.formsemestre_id) + disable_abs: str | bool = scass.has_assiduites_disable_pref(formsemestre) + menu_eval = [ { "title": "Saisir les notes", @@ -139,7 +143,8 @@ def moduleimpl_evaluation_menu(evaluation: Evaluation, nbnotes: int = 0) -> str: ), }, "enabled": evaluation.date_debut is not None - and evaluation.date_fin is not None, + and evaluation.date_fin is not None + and not disable_abs, }, { "title": "Vérifier notes vs absents", @@ -147,7 +152,9 @@ def moduleimpl_evaluation_menu(evaluation: Evaluation, nbnotes: int = 0) -> str: "args": { "evaluation_id": evaluation_id, }, - "enabled": nbnotes > 0 and evaluation.date_debut is not None, + "enabled": nbnotes > 0 + and evaluation.date_debut is not None + and not disable_abs, }, ] @@ -341,15 +348,23 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None): else: H.append('') H.append("") - H.append( - f"""Absences dans ce module""" - ) + ) # Adapté à partir d'une suggestion de DS (Le Havre) # Liens saisies absences seulement si permission et date courante dans le semestre - if current_user.has_permission(Permission.AbsChange) and formsemestre.est_courant(): + if ( + current_user.has_permission(Permission.AbsChange) + and formsemestre.est_courant() + and not disable_abs + ): group_id = sco_groups.get_default_group(formsemestre_id) H.append( f""" diff --git a/app/static/css/scodoc.css b/app/static/css/scodoc.css index b3cc3d96..4974a4e1 100644 --- a/app/static/css/scodoc.css +++ b/app/static/css/scodoc.css @@ -4931,4 +4931,8 @@ div.cas_etat_certif_ssl { margin-bottom: 8px; font-style: italic; color: rgb(231, 0, 0); +} + +.hidden { + visibility: hidden; } \ No newline at end of file