Assiduites : fix justificatifs #748

This commit is contained in:
Iziram 2023-09-24 09:18:13 +02:00
parent 71b41d3dc6
commit 14286b31ac
2 changed files with 10 additions and 2 deletions

View File

@ -457,7 +457,7 @@ def justif_edit(justif_id: int):
"après": compute_assiduites_justified(
justificatif_unique.etudid,
[justificatif_unique],
False,
True,
),
}
}

View File

@ -362,9 +362,17 @@ def compute_assiduites_justified(
for assi in assiduites:
if assi.etat == EtatAssiduite.PRESENT:
continue
assi_justificatifs = Justificatif.query.filter(
Justificatif.etudid == assi.etudid,
Justificatif.date_debut <= assi.date_debut,
Justificatif.date_fin >= assi.date_fin,
Justificatif.etat == EtatJustificatif.VALIDE,
).all()
if any(
assi.date_debut >= j.date_debut and assi.date_fin <= j.date_fin
for j in justificatifs
for j in justificatifs + assi_justificatifs
):
assi.est_just = True
assiduites_justifiees.append(assi.assiduite_id)