Assiduité : non affichage si préférence

This commit is contained in:
Iziram 2024-07-09 15:23:36 +02:00
parent d4f206cc3e
commit 72c6696151
4 changed files with 76 additions and 25 deletions

View File

@ -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('<div class="sem-groups-abs">')
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')}
</div>
<div class="sem-groups-partition-titre">{
"Assiduité" if not partition_is_empty else ""
"Assiduité" if not partition_is_empty and not show_abs else ""
}</div>
"""
)
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</a>
</div>
</div>
<div class="sem-groups-assi">
<div class="sem-groups-assi {show_abs}">
"""
)
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"""<p>
<a class="stdlink" href="{url_for('assiduites.feuille_abs_formsemestre',
@ -923,9 +928,11 @@ def _make_listes_sem(formsemestre: FormSemestre) -> str:
# --- Lien Traitement Justificatifs:
if current_user.has_permission(
Permission.AbsJustifView
) and current_user.has_permission(Permission.JustifValidate):
if (
current_user.has_permission(Permission.AbsJustifView)
and current_user.has_permission(Permission.JustifValidate)
and not disable_abs
):
H.append(
f"""<p>
<a class="stdlink" href="{url_for('assiduites.traitement_justificatifs',
@ -936,6 +943,15 @@ def _make_listes_sem(formsemestre: FormSemestre) -> str:
)
H.append("</div>")
if disable_abs:
H.append(f"""
<div class="scobox" style="width:fit-content;">
<p>La gestion des absences est désactivée dans ScoDoc pour ce semestre:</p>
<p>{disable_abs}</p>
</div>
""")
return "\n".join(H)

View File

@ -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(
[
"<h3>Assiduité</h3>",
'<ul class="ul_abs">',
"<li>",
form_choix_saisie_semaine(groups_infos), # Ajout Le Havre
"</li>",
"<li>",
form_choix_jour_saisie_hebdo(groups_infos),
"</li>",
f"""<li><a class="stdlink" href="{
liens_abs: list = [
'<ul class="ul_abs">',
"<li>",
form_choix_saisie_semaine(groups_infos), # Ajout Le Havre
"</li>",
"<li>",
form_choix_jour_saisie_hebdo(groups_infos),
"</li>",
f"""<li><a class="stdlink" href="{
url_for("assiduites.visu_assi_group", scodoc_dept=g.scodoc_dept,
group_ids=group_ids,
date_debut=formsemestre.date_debut.isoformat(),
date_fin=formsemestre.date_fin.isoformat()
)
}">État de l'assiduité du groupe</a></li>""",
"</ul>",
"</ul>",
]
if disable_abs:
liens_abs = [
f"""
<div class="scobox" style="width:fit-content;">
<p>La gestion des absences est désactivée dans ScoDoc pour ce semestre:</p>
<p>{disable_abs}</p>
</div>
"""
]
H.extend(
[
"<h3>Assiduité</h3>",
*liens_abs,
"<h3>Feuilles</h3>",
'<ul class="ul_feuilles">',
"""<li><a class="stdlink" href="%s&fmt=xlsappel">Feuille d'émargement %s (Excel)</a></li>"""

View File

@ -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('<tr><td colspan="4">')
H.append("</td></tr>")
H.append(
f"""<tr><td colspan="4"><span class="moduleimpl_abs_link"><a class="stdlink"
disable_abs: str | bool = scass.has_assiduites_disable_pref(formsemestre)
if not disable_abs:
H.append(
f"""<tr><td colspan="4"><span class="moduleimpl_abs_link"><a class="stdlink"
href="{
url_for("notes.view_module_abs", scodoc_dept=g.scodoc_dept, moduleimpl_id=moduleimpl_id)
}">Absences dans ce module</a></span>"""
)
)
# 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"""

View File

@ -4931,4 +4931,8 @@ div.cas_etat_certif_ssl {
margin-bottom: 8px;
font-style: italic;
color: rgb(231, 0, 0);
}
.hidden {
visibility: hidden;
}