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

This commit is contained in:
Iziram 2024-04-22 15:05:31 +02:00
parent 12dc837f64
commit 7322cc5b56
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é",
},
),
# (
# "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",
{

View File

@ -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;

View File

@ -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(

View File

@ -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 :
<select name="etatDef" id="etatDef">
<option value="">-</option>
{% if not non_present %}
<option value="present">présents</option>
{% endif %}
<option value="retard">en retard</option>
<option value="absent">absents</option>
</select>

View File

@ -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 @@
<div class="mass-selection">
<span>Mettre tout le monde :</span>
<fieldset class="btns_field mass">
{% if not non_present %}
<input type="checkbox" value="present" name="mass_btn_assiduites" id="mass_rbtn_present"
class="rbtn present" onclick="mettreToutLeMonde('present', this)" title="Present">
{% endif %}
<input type="checkbox" value="retard" name="mass_btn_assiduites" id="mass_rbtn_retard"
class="rbtn retard" onclick="mettreToutLeMonde('retard', this)" title="Retard">
<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,
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_fin=str(formsemestre.date_fin),
formsemestre_id=formsemestre_id,
@ -1977,6 +1982,11 @@ def signal_assiduites_diff():
formsemestre_id=formsemestre_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,
),
)