From 0a1e16e81a2bcf76b8bc0d781d340102ffbcdab7 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 3 Sep 2024 04:44:48 +0200 Subject: [PATCH] ScoData arguments --- app/but/jury_edit_manual.py | 2 +- app/views/assiduites.py | 23 ++++++++++++----------- app/views/groups.py | 2 +- app/views/jury_validations.py | 4 ++-- app/views/notes.py | 2 +- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/app/but/jury_edit_manual.py b/app/but/jury_edit_manual.py index beea5e9b9..8850c4a42 100644 --- a/app/but/jury_edit_manual.py +++ b/app/but/jury_edit_manual.py @@ -67,7 +67,7 @@ def jury_delete_manual(etud: Identite): ), rcue_vals=rcue_vals, annee_but_vals=annee_but_vals, - sco=ScoData(), + sco=ScoData(etud=etud), title=f"Toutes les décisions de jury enregistrées pour {etud.html_link_fiche()}", read_only=not current_user.has_permission(Permission.EtudInscrit), ) diff --git a/app/views/assiduites.py b/app/views/assiduites.py index eda9b41b4..eb9e59694 100644 --- a/app/views/assiduites.py +++ b/app/views/assiduites.py @@ -317,7 +317,7 @@ def ajout_assiduite_etud() -> str | Response: form=form, moduleimpl_id=moduleimpl_id, redirect_url=redirect_url, - sco=ScoData(etud, formsemestre=formsemestre), + sco=ScoData(etud=etud, formsemestre=formsemestre), tableau=tableau, scu=scu, ) @@ -653,7 +653,7 @@ def bilan_etud(): assi_seuil=_get_seuil(), date_debut=date_debut, date_fin=date_fin, - sco=ScoData(etud), + sco=ScoData(etud=etud), tableau=tableau[1], ) @@ -747,7 +747,7 @@ def edit_justificatif_etud(justif_id: int): nb_files=nb_files, title=f"Modification justificatif absence de {justif.etudiant.html_link_fiche()}", redirect_url=redirect_url, - sco=ScoData(justif.etudiant), + sco=ScoData(etud=justif.etudiant), scu=scu, readonly=not current_user.has_permission(Permission.AbsChange), ) @@ -814,7 +814,7 @@ def ajout_justificatif_etud(): form=form, title=f"Ajout justificatif absence pour {etud.html_link_fiche()}", redirect_url=redirect_url, - sco=ScoData(etud), + sco=ScoData(etud=etud), scu=scu, tableau=tableau, ) @@ -1005,7 +1005,7 @@ def calendrier_assi_etud(): # Peuplement du template jinja return render_template( "assiduites/pages/calendrier_assi_etud.j2", - sco=ScoData(etud), + sco=ScoData(etud=etud), annee=annee, nonworkdays=_non_work_days(), annees=annees_str, @@ -1230,11 +1230,10 @@ def etat_abs_date(): fmt = request.args.get("fmt", "html") group_ids = request.args.getlist("group_ids", int) evaluation_id = request.args.get("evaluation_id") - evaluation: Evaluation = ( - Evaluation.query.get_or_404(evaluation_id) - if evaluation_id is not None - else None + evaluation = ( + Evaluation.get_evaluation(evaluation_id) if evaluation_id is not None else None ) + # Vérification des dates try: date_debut = datetime.datetime.fromisoformat(date_debut_str) @@ -1286,7 +1285,9 @@ def etat_abs_date(): evaluation=evaluation, etuds=etuds, group_title=", ".join(gr.get_nom_with_part("tous") for gr in groups), - sco=ScoData(), + sco=ScoData( + formsemestre=evaluation.moduleimpl.formsemestre if evaluation else None + ), table=table, ) @@ -2159,7 +2160,7 @@ def edit_assiduite_etud(assiduite_id: int): return render_template( "assiduites/pages/edit_assiduite_etud.j2", etud=etud, - sco=ScoData(etud, formsemestre=formsemestre), + sco=ScoData(etud=etud, formsemestre=formsemestre), form=form, readonly=readonly, objet=_preparer_objet("assiduite", assi), diff --git a/app/views/groups.py b/app/views/groups.py index bff0b4685..3fbb7d9c6 100644 --- a/app/views/groups.py +++ b/app/views/groups.py @@ -78,9 +78,9 @@ def formulaire_feuille_appel(formsemestre_id: int): return render_template( "scolar/formulaire_feuille_appel.j2", - sco_data=ScoData(formsemestre=formsemestre), form=form, group_name=groups_infos.groups_titles, grp=menu_groups_choice(groups_infos), formsemestre_id=formsemestre_id, + sco=ScoData(formsemestre=formsemestre), ) diff --git a/app/views/jury_validations.py b/app/views/jury_validations.py index 656c4e8b9..1bc8fd0fd 100644 --- a/app/views/jury_validations.py +++ b/app/views/jury_validations.py @@ -868,7 +868,7 @@ def formsemestre_jury_erase(formsemestre_id: int, etudid: int = None): @permission_required(Permission.EtudInscrit) def erase_decisions_annee_formation(etudid: int, formation_id: int, annee: int): """Efface toute les décisions d'une année pour cet étudiant""" - etud: Identite = Identite.query.get_or_404(etudid) + etud = Identite.get_etud(etudid) formation: Formation = Formation.query.filter_by( id=formation_id, dept_id=g.scodoc_dept_id ).first_or_404() @@ -899,7 +899,7 @@ def erase_decisions_annee_formation(etudid: int, formation_id: int, annee: int): formation=formation, formsemestre_origine=formsemestre_origine, validations=validations, - sco=ScoData(), + sco=ScoData(etud=etud), title=f"Effacer décisions de jury {etud.nom} - année {annee}", ) diff --git a/app/views/notes.py b/app/views/notes.py index 5499641e6..9c0e0564d 100644 --- a/app/views/notes.py +++ b/app/views/notes.py @@ -339,7 +339,7 @@ def formsemestre_bulletinetud( menu_autres_operations=sco_bulletins.make_menu_autres_operations( formsemestre, etud, "notes.formsemestre_bulletinetud", version ), - sco=ScoData(etud=etud), + sco=ScoData(etud=etud, formsemestre=formsemestre), scu=scu, time=time, title=f"Bul. {etud.nom} - BUT",