Update opolka/ScoDoc from ScoDoc/ScoDoc #2

Merged
opolka merged 1272 commits from ScoDoc/ScoDoc:master into master 2024-05-27 09:11:04 +02:00
3 changed files with 32 additions and 12 deletions
Showing only changes of commit 5bb4e4e0eb - Show all commits

View File

@ -188,7 +188,7 @@ class CountCalculator:
if assi.etat != scu.EtatAssiduite.PRESENT: if assi.etat != scu.EtatAssiduite.PRESENT:
_key: str = scu.EtatAssiduite.inverse().get(assi.etat).name.lower() _key: str = scu.EtatAssiduite.inverse().get(assi.etat).name.lower()
if key not in self.data[_key]["demi"]: if key not in self.data[_key]["demi"]:
self.data[_key]["demi"].append(day) self.data[_key]["demi"].append(key)
if key not in self.data["total"]["demi"]: if key not in self.data["total"]["demi"]:
self.data["total"]["demi"].append(key) self.data["total"]["demi"].append(key)

View File

@ -1492,7 +1492,9 @@ def tableau_assiduite_actions():
) )
compute_assiduites_justified(objet.etudiant.id, [justificatif_correspondant]) compute_assiduites_justified(objet.etudiant.id, [justificatif_correspondant])
scass.simple_invalidate_cache(
justificatif_correspondant.to_dict(), objet.etudiant.id
)
flash(f"{objet_name} justifiée") flash(f"{objet_name} justifiée")
return redirect(request.referrer) return redirect(request.referrer)

View File

@ -1307,6 +1307,19 @@ def test_calcul_assiduites(test_client):
scu.EtatAssiduite.ABSENT, scu.EtatAssiduite.ABSENT,
False, False,
), ),
# 18/12
(
"12-18T08:00",
"12-18T10:00",
scu.EtatAssiduite.ABSENT,
False,
),
(
"12-18T10:00",
"12-18T12:00",
scu.EtatAssiduite.ABSENT,
False,
),
] ]
for ass in assiduites: for ass in assiduites:
@ -1333,17 +1346,17 @@ def test_calcul_assiduites(test_client):
resultat_attendu: dict = { resultat_attendu: dict = {
"present": {"journee": 5, "demi": 8, "heure": 13.25, "compte": 9}, "present": {"journee": 5, "demi": 8, "heure": 13.25, "compte": 9},
"absent": { "absent": {
"journee": 5 + 5, "journee": 6 + 5,
"demi": 7 + 10, "demi": 8 + 10,
"heure": 11.25 + 42, "heure": 15.25 + 42,
"compte": 7 + 1, "compte": 9 + 1,
}, },
"absent_just": {"journee": 3, "demi": 3, "heure": 4.25, "compte": 3}, "absent_just": {"journee": 3, "demi": 3, "heure": 4.25, "compte": 3},
"absent_non_just": { "absent_non_just": {
"journee": 3 + 5, "journee": 4 + 5,
"demi": 4 + 10, "demi": 5 + 10,
"heure": 7 + 42, "heure": 11 + 42,
"compte": 4 + 1, "compte": 6 + 1,
}, },
"retard": { "retard": {
"journee": 5, "journee": 5,
@ -1353,9 +1366,14 @@ def test_calcul_assiduites(test_client):
}, },
"retard_just": {"journee": 3, "demi": 3, "heure": 2.5, "compte": 3}, "retard_just": {"journee": 3, "demi": 3, "heure": 2.5, "compte": 3},
"retard_non_just": {"journee": 3, "demi": 4, "heure": 8.0, "compte": 4}, "retard_non_just": {"journee": 3, "demi": 4, "heure": 8.0, "compte": 4},
"total": {"journee": 10, "demi": 19, "heure": 77.0, "compte": 24}, "total": {"journee": 11, "demi": 20, "heure": 81.0, "compte": 26},
} }
for key in resultat_attendu:
assert (
resultat_attendu[key]["journee"] * 2 >= resultat_attendu[key]["demi"]
), f"Trop de demi-journées [{key}]"
for key in resultat_attendu: for key in resultat_attendu:
for key2 in resultat_attendu[key]: for key2 in resultat_attendu[key]:
assert ( assert (