From c960d943d2596392c9a399a76ca4eaaed09cb21f Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 27 Feb 2024 21:51:43 +0100 Subject: [PATCH] Merge assiduites --- app/scodoc/sco_assiduites.py | 19 +++++-------------- app/scodoc/sco_evaluation_check_abs.py | 6 +++--- app/scodoc/sco_formsemestre_edit.py | 13 ++----------- app/scodoc/sco_formsemestre_status.py | 2 +- app/views/assiduites.py | 2 +- 5 files changed, 12 insertions(+), 30 deletions(-) diff --git a/app/scodoc/sco_assiduites.py b/app/scodoc/sco_assiduites.py index 3729d867..3b991740 100644 --- a/app/scodoc/sco_assiduites.py +++ b/app/scodoc/sco_assiduites.py @@ -21,7 +21,6 @@ from app.models.assiduites import Assiduite, Justificatif, compute_assiduites_ju from app.scodoc import sco_formsemestre_inscriptions from app.scodoc import sco_preferences from app.scodoc import sco_cache -from app.scodoc import sco_compute_moy from app.scodoc import sco_etud import app.scodoc.sco_utils as scu @@ -112,9 +111,9 @@ class CountCalculator: evening if evening else ScoDocSiteConfig.get("assi_afternoon_time", "18:00") ) - self.non_work_days: list[ - scu.NonWorkDays - ] = scu.NonWorkDays.get_all_non_work_days(dept_id=g.scodoc_dept_id) + self.non_work_days: list[scu.NonWorkDays] = ( + scu.NonWorkDays.get_all_non_work_days(dept_id=g.scodoc_dept_id) + ) # Sera utilisé pour les assiduités longues (> 1 journée) self.nb_heures_par_jour = ( @@ -794,17 +793,9 @@ def invalidate_assiduites_etud_date(etudid: int, the_date: datetime): # Invalide les PDF et les absences: for sem in sems: # Inval cache bulletin et/ou note_table - if sco_compute_moy.formsemestre_expressions_use_abscounts( - sem["formsemestre_id"] - ): - # certaines formules utilisent les absences - pdfonly = False - else: - # efface toujours le PDF car il affiche en général les absences - pdfonly = True - + # efface toujours le PDF car il affiche en général les absences sco_cache.invalidate_formsemestre( - formsemestre_id=sem["formsemestre_id"], pdfonly=pdfonly + formsemestre_id=sem["formsemestre_id"], pdfonly=True ) # Inval cache compteurs absences: diff --git a/app/scodoc/sco_evaluation_check_abs.py b/app/scodoc/sco_evaluation_check_abs.py index eb35312d..0349e8f5 100644 --- a/app/scodoc/sco_evaluation_check_abs.py +++ b/app/scodoc/sco_evaluation_check_abs.py @@ -70,9 +70,9 @@ def evaluation_check_absences(evaluation: Evaluation): deb <= Assiduite.date_fin, ) - abs_etudids = set(assi.etudid for assi in assiduites) - abs_nj_etudids = set(assi.etudid for assi in assiduites if assi.est_just is False) - just_etudids = set(assi.etudid for assi in assiduites if assi.est_just is True) + abs_etudids = {assi.etudid for assi in assiduites} + abs_nj_etudids = {assi.etudid for assi in assiduites if assi.est_just is False} + just_etudids = {assi.etudid for assi in assiduites if assi.est_just is True} # Les notes: notes_db = sco_evaluation_db.do_evaluation_get_all_notes(evaluation.id) diff --git a/app/scodoc/sco_formsemestre_edit.py b/app/scodoc/sco_formsemestre_edit.py index 921c0070..9321b511 100644 --- a/app/scodoc/sco_formsemestre_edit.py +++ b/app/scodoc/sco_formsemestre_edit.py @@ -1337,21 +1337,12 @@ def do_formsemestre_clone( % (pname, pvalue, formsemestre_id) ) - # 5- Copy formules utilisateur - objs = sco_compute_moy.formsemestre_ue_computation_expr_list( - cnx, args={"formsemestre_id": orig_formsemestre_id} - ) - for obj in objs: - args = obj.copy() - args["formsemestre_id"] = formsemestre_id - _ = sco_compute_moy.formsemestre_ue_computation_expr_create(cnx, args) - - # 6- Copie les parcours + # 5- Copie les parcours formsemestre.parcours = formsemestre_orig.parcours db.session.add(formsemestre) db.session.commit() - # 7- Copy partitions and groups + # 6- Copy partitions and groups if clone_partitions: sco_groups_copy.clone_partitions_and_groups( orig_formsemestre_id, formsemestre_id diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index c5fce57b..027ac8df 100755 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -1216,7 +1216,7 @@ def formsemestre_tableau_modules( if expr: H.append( f""" {expr} - formule inutilisée en 9.2: formule inutilisée en ScoDoc 9: supprimer""" diff --git a/app/views/assiduites.py b/app/views/assiduites.py index f95aeff5..b358276f 100644 --- a/app/views/assiduites.py +++ b/app/views/assiduites.py @@ -538,7 +538,7 @@ def bilan_etud(): # Récupération des assiduités et justificatifs de l'étudiant data = liste_assi.AssiJustifData( etud.assiduites.filter( - Assiduite.etat != scu.EtatAssiduite.PRESENT, Assiduite.est_just is False + Assiduite.etat != scu.EtatAssiduite.PRESENT, Assiduite.est_just == False ), etud.justificatifs.filter( Justificatif.etat.in_(