From 4c730a6302b90dd7737f500b8439d73ab7bb4927 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 28 Nov 2022 19:13:57 +0100 Subject: [PATCH] API: formsemestre/bulletins au format long_mat. --- app/api/formsemestres.py | 12 +++++++++--- sco_version.py | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/api/formsemestres.py b/app/api/formsemestres.py index 38794d62..1c1db110 100644 --- a/app/api/formsemestres.py +++ b/app/api/formsemestres.py @@ -147,11 +147,13 @@ def formsemestres_query(): @bp.route("/formsemestre//bulletins") +@bp.route("/formsemestre//bulletins/") @api_web_bp.route("/formsemestre//bulletins") +@api_web_bp.route("/formsemestre//bulletins/") @login_required @scodoc @permission_required(Permission.ScoView) -def bulletins(formsemestre_id: int): +def bulletins(formsemestre_id: int, version: str = "long"): """ Retourne les bulletins d'un formsemestre donné @@ -162,12 +164,16 @@ def bulletins(formsemestre_id: int): query = FormSemestre.query.filter_by(id=formsemestre_id) if g.scodoc_dept: query = query.filter_by(dept_id=g.scodoc_dept_id) - formsemestre: FormSemestre = query.first_or_404(formsemestre_id) + formsemestre: FormSemestre = query.first() + if formsemestre is None: + return json_error(404, "formsemestre non trouve") app.set_sco_dept(formsemestre.departement.acronym) data = [] for etu in formsemestre.etuds: - bul_etu = get_formsemestre_bulletin_etud_json(formsemestre, etu) + bul_etu = get_formsemestre_bulletin_etud_json( + formsemestre, etu, version=version + ) data.append(bul_etu.json) return jsonify(data) diff --git a/sco_version.py b/sco_version.py index a32fca6b..6ef4172c 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.4.5" +SCOVERSION = "9.4.6" SCONAME = "ScoDoc"