From 3631719f54eb373944cc99d54e1096a7f77fe75a Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 21 Dec 2021 23:05:49 +0100 Subject: [PATCH] fix #238 --- app/scodoc/sco_abs_views.py | 15 ++++++++++----- app/scodoc/sco_evaluations.py | 2 +- app/views/absences.py | 6 ++++-- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/app/scodoc/sco_abs_views.py b/app/scodoc/sco_abs_views.py index b21cb8c0b8..4e5aaa4695 100644 --- a/app/scodoc/sco_abs_views.py +++ b/app/scodoc/sco_abs_views.py @@ -30,7 +30,7 @@ """ import datetime -from flask import url_for, g, request +from flask import url_for, g, request, abort import app.scodoc.sco_utils as scu from app.scodoc import notesdb as ndb @@ -773,7 +773,8 @@ def CalAbs(etudid, sco_year=None): def ListeAbsEtud( - etudid, + etudid=None, + code_nip=None, with_evals=True, format="html", absjust_only=0, @@ -793,9 +794,13 @@ def ListeAbsEtud( # si absjust_only, table absjust seule (export xls ou pdf) absjust_only = ndb.bool_or_str(absjust_only) datedebut = "%s-08-01" % scu.AnneeScolaire(sco_year=sco_year) - - etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0] - + etudid = etudid or False + etuds = sco_etud.get_etud_info(etudid=etudid, code_nip=code_nip, filled=True) + if not etuds: + log(f"ListeAbsEtud: no etuds with etudid={etudid} or nip={code_nip}") + abort(404) + etud = etuds[0] + etudid = etud["etudid"] # Liste des absences et titres colonnes tables: titles, columns_ids, absnonjust, absjust = _tables_abs_etud( etudid, datedebut, with_evals=with_evals, format=format diff --git a/app/scodoc/sco_evaluations.py b/app/scodoc/sco_evaluations.py index 7d6bb82b10..e06e6b542b 100644 --- a/app/scodoc/sco_evaluations.py +++ b/app/scodoc/sco_evaluations.py @@ -98,7 +98,7 @@ def ListMedian(L): def do_evaluation_etat(evaluation_id, partition_id=None, select_first_partition=False): - """donne infos sur l'etat du evaluation + """donne infos sur l'état de l'évaluation { nb_inscrits, nb_notes, nb_abs, nb_neutre, nb_att, moyenne, mediane, mini, maxi, date_last_modif, gr_complets, gr_incomplets, evalcomplete } diff --git a/app/views/absences.py b/app/views/absences.py index a475988b07..a3f893518c 100644 --- a/app/views/absences.py +++ b/app/views/absences.py @@ -251,14 +251,16 @@ sco_publish( @permission_required_compat_scodoc7(Permission.ScoView) @scodoc7func def ListeAbsEtud( - etudid, + etudid=None, + code_nip=None, with_evals=True, format="html", absjust_only=0, sco_year=None, ): return sco_abs_views.ListeAbsEtud( - etudid, + etudid=etudid, + code_nip=str(code_nip), with_evals=with_evals, format=format, absjust_only=absjust_only,