1
0
forked from ScoDoc/ScoDoc

gestion d'erreurs pour la route formsemestre_apo

This commit is contained in:
leonard_montalbano 2022-06-28 16:02:15 +02:00
parent 85e7818843
commit 3297819892

View File

@ -7,6 +7,7 @@ import app
from app import models
from app.api import bp
from app.api.auth import token_auth, token_permission_required
from app.api.errors import error_response
from app.comp import res_sem
from app.comp.moy_mod import ModuleImplResults
from app.comp.res_compat import NotesTableCompat
@ -91,7 +92,13 @@ def formsemestre_apo(etape_apo: str):
FormSemestreEtape.formsemestre_id == FormSemestre.id,
)
return jsonify([formsemestre.to_dict() for formsemestre in formsemestres])
res = [formsemestre.to_dict() for formsemestre in formsemestres]
if len(res) == 0:
return error_response(
404, message="Aucun formsemestre trouvé avec cette étape apogée"
)
else:
return jsonify(res)
@bp.route("/formsemestre/<int:formsemestre_id>/bulletins", methods=["GET"])