Assiduité : désactiver saisie présence closes #793

This commit is contained in:
Iziram 2024-04-22 15:05:31 +02:00 committed by Emmanuel Viennet
parent 5d45fcf656
commit 4d234ba353
6 changed files with 62 additions and 26 deletions

View File

@ -611,16 +611,17 @@ class BasePreferences:
"explanation": "toute saisie d'absence doit indiquer le module concerné", "explanation": "toute saisie d'absence doit indiquer le module concerné",
}, },
), ),
# ( (
# "forcer_present", "non_present",
# { {
# "initvalue": 0, "initvalue": 0,
# "title": "Forcer l'appel des présents", "title": "Désactiver la saisie des présences",
# "input_type": "boolcheckbox", "input_type": "boolcheckbox",
# "labels": ["non", "oui"], "labels": ["non", "oui"],
# "category": "assi", "category": "assi",
# }, "explanation": "Désactive la saisie et l'affichage des présences",
# ), },
),
( (
"periode_defaut", "periode_defaut",
{ {
@ -644,18 +645,18 @@ class BasePreferences:
"category": "assi", "category": "assi",
}, },
), ),
( # (
"assi_etat_defaut", # "assi_etat_defaut",
{ # {
"explanation": "⚠ non fonctionnel, travaux en cours !", # "explanation": "⚠ non fonctionnel, travaux en cours !",
"initvalue": "aucun", # "initvalue": "aucun",
"input_type": "menu", # "input_type": "menu",
"labels": ["aucun", "present", "retard", "absent"], # "labels": ["aucun", "present", "retard", "absent"],
"allowed_values": ["aucun", "present", "retard", "absent"], # "allowed_values": ["aucun", "present", "retard", "absent"],
"title": "Définir l'état par défaut", # "title": "Définir l'état par défaut",
"category": "assi", # "category": "assi",
}, # },
), # ),
( (
"non_travail", "non_travail",
{ {

View File

@ -296,7 +296,13 @@ function creerLigneEtudiant(etud, index) {
// Création des boutons d'assiduités // Création des boutons d'assiduités
if (readOnly) { if (readOnly) {
} else if (currentAssiduite.type != "conflit") { } 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"); const btn = document.createElement("input");
btn.type = "checkbox"; btn.type = "checkbox";
btn.value = abs; btn.value = abs;

View File

@ -4,8 +4,8 @@
# See LICENSE # See LICENSE
############################################################################## ##############################################################################
"""Liste simple d'étudiants """Liste simple d'étudiants"""
"""
import datetime import datetime
from flask import g, url_for from flask import g, url_for
from app import log from app import log
@ -140,6 +140,13 @@ class RowAssi(tb.Row):
) )
stats = self._get_etud_stats(etud) stats = self._get_etud_stats(etud)
for key, value in stats.items(): 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") self.add_cell(key, value[0], fmt_num(value[1] - value[2]), "assi_stats")
if key != "present": if key != "present":
self.add_cell( self.add_cell(

View File

@ -310,8 +310,13 @@ async function nouvellePeriode(period = null) {
const assi_btns = document.createElement('div'); const assi_btns = document.createElement('div');
assi_btns.classList.add('assi-btns'); 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"); const cbox = document.createElement("input");
cbox.type = "checkbox"; cbox.type = "checkbox";
cbox.value = value; cbox.value = value;
@ -499,6 +504,8 @@ const moduleimpls = new Map();
const inscriptionsModules = new Map(); const inscriptionsModules = new Map();
const nonWorkDays = [{{ nonworkdays| safe }}]; const nonWorkDays = [{{ nonworkdays| safe }}];
window.nonPresent = {{ 'true' if non_present else 'false' }};
// Vérification du forçage de module // Vérification du forçage de module
window.forceModule = "{{ forcer_module }}" == "True"; window.forceModule = "{{ forcer_module }}" == "True";
if (window.forceModule) { if (window.forceModule) {
@ -600,7 +607,9 @@ main();
Intialiser les étudiants comme : Intialiser les étudiants comme :
<select name="etatDef" id="etatDef"> <select name="etatDef" id="etatDef">
<option value="">-</option> <option value="">-</option>
{% if not non_present %}
<option value="present">présents</option> <option value="present">présents</option>
{% endif %}
<option value="retard">en retard</option> <option value="retard">en retard</option>
<option value="absent">absents</option> <option value="absent">absents</option>
</select> </select>

View File

@ -31,6 +31,7 @@
const readOnly = {{ readonly }}; const readOnly = {{ readonly }};
window.forceModule = "{{ forcer_module }}" == "True" window.forceModule = "{{ forcer_module }}" == "True"
window.nonPresent = {{ 'true' if non_present else 'false' }};
const etudsDefDem = {{ defdem | safe }} const etudsDefDem = {{ defdem | safe }}
@ -159,8 +160,10 @@
<div class="mass-selection"> <div class="mass-selection">
<span>Mettre tout le monde :</span> <span>Mettre tout le monde :</span>
<fieldset class="btns_field mass"> <fieldset class="btns_field mass">
{% if not non_present %}
<input type="checkbox" value="present" name="mass_btn_assiduites" id="mass_rbtn_present" <input type="checkbox" value="present" name="mass_btn_assiduites" id="mass_rbtn_present"
class="rbtn present" onclick="mettreToutLeMonde('present', this)" title="Present"> class="rbtn present" onclick="mettreToutLeMonde('present', this)" title="Present">
{% endif %}
<input type="checkbox" value="retard" name="mass_btn_assiduites" id="mass_rbtn_retard" <input type="checkbox" value="retard" name="mass_btn_assiduites" id="mass_rbtn_retard"
class="rbtn retard" onclick="mettreToutLeMonde('retard', this)" title="Retard"> class="rbtn retard" onclick="mettreToutLeMonde('retard', this)" title="Retard">
<input type="checkbox" value="absent" name="mass_btn_assiduites" id="mass_rbtn_absent" <input type="checkbox" value="absent" name="mass_btn_assiduites" id="mass_rbtn_absent"

View File

@ -1132,6 +1132,11 @@ def signal_assiduites_group():
formsemestre_id=formsemestre_id, formsemestre_id=formsemestre_id,
dept_id=g.scodoc_dept_id, dept_id=g.scodoc_dept_id,
), ),
non_present=sco_preferences.get_preference(
"non_present",
formsemestre_id=formsemestre_id,
dept_id=g.scodoc_dept_id,
),
formsemestre_date_debut=str(formsemestre.date_debut), formsemestre_date_debut=str(formsemestre.date_debut),
formsemestre_date_fin=str(formsemestre.date_fin), formsemestre_date_fin=str(formsemestre.date_fin),
formsemestre_id=formsemestre_id, formsemestre_id=formsemestre_id,
@ -1977,6 +1982,11 @@ def signal_assiduites_diff():
formsemestre_id=formsemestre_id, formsemestre_id=formsemestre_id,
dept_id=g.scodoc_dept_id, dept_id=g.scodoc_dept_id,
), ),
non_present=sco_preferences.get_preference(
"non_present",
formsemestre_id=formsemestre_id,
dept_id=g.scodoc_dept_id,
),
) )