forked from ScoDoc/ScoDoc
Assiduites : fix #686
This commit is contained in:
parent
3eb8869349
commit
6cbfd97031
@ -46,6 +46,7 @@ from app.models import (
|
||||
Module,
|
||||
ModuleImpl,
|
||||
ScolarNews,
|
||||
Assiduite,
|
||||
)
|
||||
from app.models.etudiants import Identite
|
||||
|
||||
@ -75,6 +76,8 @@ import app.scodoc.sco_utils as scu
|
||||
from app.scodoc.sco_utils import json_error
|
||||
from app.scodoc.sco_utils import ModuleType
|
||||
|
||||
from flask_sqlalchemy.query import Query
|
||||
|
||||
|
||||
def convert_note_from_string(
|
||||
note: str,
|
||||
@ -1102,30 +1105,21 @@ def _get_sorted_etuds(evaluation: Evaluation, etudids: list, formsemestre_id: in
|
||||
# Groupes auxquels appartient cet étudiant:
|
||||
e["groups"] = sco_groups.get_etud_groups(etudid, formsemestre_id)
|
||||
|
||||
# Information sur absence (tenant compte de la demi-journée)
|
||||
jour_iso = (
|
||||
evaluation.date_debut.date().isoformat() if evaluation.date_debut else ""
|
||||
# Information sur absence
|
||||
warn_abs_lst: str = ""
|
||||
if evaluation.date_debut is not None and evaluation.date_fin is not None:
|
||||
assiduites_etud: Query = etud.assiduites.filter(
|
||||
Assiduite.etat == scu.EtatAssiduite.ABSENT,
|
||||
Assiduite.date_debut <= evaluation.date_fin,
|
||||
Assiduite.date_fin >= evaluation.date_debut,
|
||||
)
|
||||
premiere_assi: Assiduite = assiduites_etud.first()
|
||||
if premiere_assi is not None:
|
||||
warn_abs_lst: str = (
|
||||
f"absent {'justifié' if premiere_assi.est_just else ''}"
|
||||
)
|
||||
warn_abs_lst = []
|
||||
# XXX TODO-ASSIDUITE (issue #686)
|
||||
if evaluation.is_matin():
|
||||
nbabs = 0 # TODO-ASSIDUITE sco_abs.count_abs(etudid, jour_iso, jour_iso, matin=True)
|
||||
nbabsjust = 0 # TODO-ASSIDUITE sco_abs.count_abs_just(etudid, jour_iso, jour_iso, matin=True)
|
||||
if nbabs:
|
||||
if nbabsjust:
|
||||
warn_abs_lst.append("absent justifié le matin !")
|
||||
else:
|
||||
warn_abs_lst.append("absent le matin !")
|
||||
if evaluation.is_apresmidi():
|
||||
nbabs = 0 # TODO-ASSIDUITE sco_abs.count_abs(etudid, jour_iso, jour_iso, matin=0)
|
||||
nbabsjust = 0 # TODO-ASSIDUITE sco_abs.count_abs_just(etudid, jour_iso, jour_iso, matin=0)
|
||||
if nbabs:
|
||||
if nbabsjust:
|
||||
warn_abs_lst.append("absent justifié l'après-midi !")
|
||||
else:
|
||||
warn_abs_lst.append("absent l'après-midi !")
|
||||
|
||||
e["absinfo"] = '<span class="sn_abs">' + " ".join(warn_abs_lst) + "</span> "
|
||||
e["absinfo"] = '<span class="sn_abs">' + warn_abs_lst + "</span> "
|
||||
|
||||
# Note actuelle de l'étudiant:
|
||||
if etudid in notes_db:
|
||||
|
Loading…
Reference in New Issue
Block a user