forked from ScoDoc/ScoDoc
gestion d'erreurs pour la route formsemestre_apo
This commit is contained in:
parent
85e7818843
commit
3297819892
@ -7,6 +7,7 @@ import app
|
|||||||
from app import models
|
from app import models
|
||||||
from app.api import bp
|
from app.api import bp
|
||||||
from app.api.auth import token_auth, token_permission_required
|
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 import res_sem
|
||||||
from app.comp.moy_mod import ModuleImplResults
|
from app.comp.moy_mod import ModuleImplResults
|
||||||
from app.comp.res_compat import NotesTableCompat
|
from app.comp.res_compat import NotesTableCompat
|
||||||
@ -91,7 +92,13 @@ def formsemestre_apo(etape_apo: str):
|
|||||||
FormSemestreEtape.formsemestre_id == FormSemestre.id,
|
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"])
|
@bp.route("/formsemestre/<int:formsemestre_id>/bulletins", methods=["GET"])
|
||||||
|
Loading…
Reference in New Issue
Block a user