diff --git a/app/scodoc/sco_preferences.py b/app/scodoc/sco_preferences.py index fa8197f3f..effc1e68c 100644 --- a/app/scodoc/sco_preferences.py +++ b/app/scodoc/sco_preferences.py @@ -611,16 +611,17 @@ class BasePreferences: "explanation": "toute saisie d'absence doit indiquer le module concerné", }, ), - # ( - # "forcer_present", - # { - # "initvalue": 0, - # "title": "Forcer l'appel des présents", - # "input_type": "boolcheckbox", - # "labels": ["non", "oui"], - # "category": "assi", - # }, - # ), + ( + "non_present", + { + "initvalue": 0, + "title": "Désactiver la saisie des présences", + "input_type": "boolcheckbox", + "labels": ["non", "oui"], + "category": "assi", + "explanation": "Désactive la saisie et l'affichage des présences", + }, + ), ( "periode_defaut", { @@ -644,18 +645,18 @@ class BasePreferences: "category": "assi", }, ), - ( - "assi_etat_defaut", - { - "explanation": "⚠ non fonctionnel, travaux en cours !", - "initvalue": "aucun", - "input_type": "menu", - "labels": ["aucun", "present", "retard", "absent"], - "allowed_values": ["aucun", "present", "retard", "absent"], - "title": "Définir l'état par défaut", - "category": "assi", - }, - ), + # ( + # "assi_etat_defaut", + # { + # "explanation": "⚠ non fonctionnel, travaux en cours !", + # "initvalue": "aucun", + # "input_type": "menu", + # "labels": ["aucun", "present", "retard", "absent"], + # "allowed_values": ["aucun", "present", "retard", "absent"], + # "title": "Définir l'état par défaut", + # "category": "assi", + # }, + # ), ( "non_travail", { diff --git a/app/static/js/assiduites.js b/app/static/js/assiduites.js index 30cddade0..00757640e 100644 --- a/app/static/js/assiduites.js +++ b/app/static/js/assiduites.js @@ -296,7 +296,13 @@ function creerLigneEtudiant(etud, index) { // Création des boutons d'assiduités if (readOnly) { } else if (currentAssiduite.type != "conflit") { - ["present", "retard", "absent"].forEach((abs) => { + const etats = ["retard", "absent"]; + + if (!window.nonPresent) { + etats.splice(0, 0, "present"); + } + + etats.forEach((abs) => { const btn = document.createElement("input"); btn.type = "checkbox"; btn.value = abs; diff --git a/app/tables/visu_assiduites.py b/app/tables/visu_assiduites.py index af3895e7b..11fa4896e 100644 --- a/app/tables/visu_assiduites.py +++ b/app/tables/visu_assiduites.py @@ -4,8 +4,8 @@ # See LICENSE ############################################################################## -"""Liste simple d'étudiants -""" +"""Liste simple d'étudiants""" + import datetime from flask import g, url_for from app import log @@ -140,6 +140,13 @@ class RowAssi(tb.Row): ) stats = self._get_etud_stats(etud) for key, value in stats.items(): + if key == "present" and sco_preferences.get_preference( + "non_present", + dept_id=g.scodoc_dept_id, + formsemestre_id=self.table.formsemestre.id, + ): + continue + self.add_cell(key, value[0], fmt_num(value[1] - value[2]), "assi_stats") if key != "present": self.add_cell( diff --git a/app/templates/assiduites/pages/signal_assiduites_diff.j2 b/app/templates/assiduites/pages/signal_assiduites_diff.j2 index 474c6db5e..76d40d43d 100644 --- a/app/templates/assiduites/pages/signal_assiduites_diff.j2 +++ b/app/templates/assiduites/pages/signal_assiduites_diff.j2 @@ -310,8 +310,13 @@ async function nouvellePeriode(period = null) { const assi_btns = document.createElement('div'); assi_btns.classList.add('assi-btns'); + const etats = ["retard", "absent"]; - ["present", "retard", "absent"].forEach((value) => { + if(!window.nonPresent){ + etats.splice(0,0,"present"); + } + + etats.forEach((value) => { const cbox = document.createElement("input"); cbox.type = "checkbox"; cbox.value = value; @@ -499,6 +504,8 @@ const moduleimpls = new Map(); const inscriptionsModules = new Map(); const nonWorkDays = [{{ nonworkdays| safe }}]; +window.nonPresent = {{ 'true' if non_present else 'false' }}; + // Vérification du forçage de module window.forceModule = "{{ forcer_module }}" == "True"; if (window.forceModule) { @@ -600,7 +607,9 @@ main(); Intialiser les étudiants comme : diff --git a/app/templates/assiduites/pages/signal_assiduites_group.j2 b/app/templates/assiduites/pages/signal_assiduites_group.j2 index 2f46b07ae..737440403 100644 --- a/app/templates/assiduites/pages/signal_assiduites_group.j2 +++ b/app/templates/assiduites/pages/signal_assiduites_group.j2 @@ -31,6 +31,7 @@ const readOnly = {{ readonly }}; window.forceModule = "{{ forcer_module }}" == "True" + window.nonPresent = {{ 'true' if non_present else 'false' }}; const etudsDefDem = {{ defdem | safe }} @@ -159,8 +160,10 @@