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 html_sco_header
from app.scodoc import htmlutils from app.scodoc import htmlutils
from app.scodoc import sco_archives_formsemestre 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 sco_bulletins
from app.scodoc import codes_cursus from app.scodoc import codes_cursus
from app.scodoc import sco_compute_moy 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">') 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) # Genere liste pour chaque partition (categorie de groupes)
for partition in formsemestre.get_partitions_list(): for partition in formsemestre.get_partitions_list():
groups = partition.groups.all() 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')} ('aucun étudiant inscrit' if partition_is_empty else 'Tous les étudiants')}
</div> </div>
<div class="sem-groups-partition-titre">{ <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> }</div>
""" """
) )
if groups: if groups:
for group in groups: for group in groups:
n_members = effectifs[group.id] n_members = effectifs[group.id]
@ -821,8 +827,7 @@ def _make_listes_sem(formsemestre: FormSemestre) -> str:
- {n_members} étudiants</a> - {n_members} étudiants</a>
</div> </div>
</div> </div>
<div class="sem-groups-assi"> <div class="sem-groups-assi {show_abs}">
""" """
) )
if can_edit_abs: if can_edit_abs:
@ -911,7 +916,7 @@ def _make_listes_sem(formsemestre: FormSemestre) -> str:
) )
# --- Formulaire importation Assiduité excel (si autorisé) # --- 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( H.append(
f"""<p> f"""<p>
<a class="stdlink" href="{url_for('assiduites.feuille_abs_formsemestre', <a class="stdlink" href="{url_for('assiduites.feuille_abs_formsemestre',
@ -923,9 +928,11 @@ def _make_listes_sem(formsemestre: FormSemestre) -> str:
# --- Lien Traitement Justificatifs: # --- Lien Traitement Justificatifs:
if current_user.has_permission( if (
Permission.AbsJustifView current_user.has_permission(Permission.AbsJustifView)
) and current_user.has_permission(Permission.JustifValidate): and current_user.has_permission(Permission.JustifValidate)
and not disable_abs
):
H.append( H.append(
f"""<p> f"""<p>
<a class="stdlink" href="{url_for('assiduites.traitement_justificatifs', <a class="stdlink" href="{url_for('assiduites.traitement_justificatifs',
@ -936,6 +943,15 @@ def _make_listes_sem(formsemestre: FormSemestre) -> str:
) )
H.append("</div>") 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) return "\n".join(H)

View File

@ -42,6 +42,7 @@ from app import db
from app.models import FormSemestre, Identite from app.models import FormSemestre, Identite
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc import html_sco_header 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_excel
from app.scodoc import sco_formsemestre from app.scodoc import sco_formsemestre
from app.scodoc import sco_groups from app.scodoc import sco_groups
@ -894,10 +895,9 @@ def tab_absences_html(groups_infos, etat=None):
group_ids: str = ",".join(map(str, groups_infos.group_ids)) group_ids: str = ",".join(map(str, groups_infos.group_ids))
formsemestre: FormSemestre = groups_infos.get_formsemestre() formsemestre: FormSemestre = groups_infos.get_formsemestre()
disable_abs: str | bool = scass.has_assiduites_disable_pref(formsemestre)
H.extend( liens_abs: list = [
[
"<h3>Assiduité</h3>",
'<ul class="ul_abs">', '<ul class="ul_abs">',
"<li>", "<li>",
form_choix_saisie_semaine(groups_infos), # Ajout Le Havre form_choix_saisie_semaine(groups_infos), # Ajout Le Havre
@ -913,6 +913,22 @@ def tab_absences_html(groups_infos, etat=None):
) )
}">État de l'assiduité du groupe</a></li>""", }">É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>", "<h3>Feuilles</h3>",
'<ul class="ul_feuilles">', '<ul class="ul_feuilles">',
"""<li><a class="stdlink" href="%s&fmt=xlsappel">Feuille d'émargement %s (Excel)</a></li>""" """<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.comp.res_compat import NotesTableCompat
from app.models import Evaluation, FormSemestre, Module, ModuleImpl, UniteEns from app.models import Evaluation, FormSemestre, Module, ModuleImpl, UniteEns
import app.scodoc.sco_utils as scu 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.codes_cursus import UE_SPORT
from app.scodoc.sco_exceptions import ScoInvalidIdType from app.scodoc.sco_exceptions import ScoInvalidIdType
from app.scodoc.sco_cursus_dut import formsemestre_has_decisions 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: else:
sup_label = "Supprimer évaluation" sup_label = "Supprimer évaluation"
formsemestre: FormSemestre = FormSemestre.get_formsemestre(modimpl.formsemestre_id)
disable_abs: str | bool = scass.has_assiduites_disable_pref(formsemestre)
menu_eval = [ menu_eval = [
{ {
"title": "Saisir les notes", "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 "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", "title": "Vérifier notes vs absents",
@ -147,7 +152,9 @@ def moduleimpl_evaluation_menu(evaluation: Evaluation, nbnotes: int = 0) -> str:
"args": { "args": {
"evaluation_id": evaluation_id, "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,6 +348,10 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
else: else:
H.append('<tr><td colspan="4">') H.append('<tr><td colspan="4">')
H.append("</td></tr>") H.append("</td></tr>")
disable_abs: str | bool = scass.has_assiduites_disable_pref(formsemestre)
if not disable_abs:
H.append( H.append(
f"""<tr><td colspan="4"><span class="moduleimpl_abs_link"><a class="stdlink" f"""<tr><td colspan="4"><span class="moduleimpl_abs_link"><a class="stdlink"
href="{ href="{
@ -349,7 +360,11 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
) )
# Adapté à partir d'une suggestion de DS (Le Havre) # Adapté à partir d'une suggestion de DS (Le Havre)
# Liens saisies absences seulement si permission et date courante dans le semestre # 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) group_id = sco_groups.get_default_group(formsemestre_id)
H.append( H.append(
f""" f"""

View File

@ -4932,3 +4932,7 @@ div.cas_etat_certif_ssl {
font-style: italic; font-style: italic;
color: rgb(231, 0, 0); color: rgb(231, 0, 0);
} }
.hidden {
visibility: hidden;
}