1
0
forked from ScoDoc/ScoDoc

API: erreurs sans abort() + fix ok:true

This commit is contained in:
Emmanuel Viennet 2022-07-25 07:07:45 +02:00
parent 26454de0c4
commit 692c5b0369
2 changed files with 4 additions and 4 deletions

View File

@ -93,7 +93,7 @@ def formsemestres_query():
try: try:
annee_scolaire_int = int(annee_scolaire) annee_scolaire_int = int(annee_scolaire)
except ValueError: except ValueError:
abort(404, "invalid annee_scolaire: not int") return error_response(404, "invalid annee_scolaire: not int")
debut_annee = scu.date_debut_anne_scolaire(annee_scolaire_int) debut_annee = scu.date_debut_anne_scolaire(annee_scolaire_int)
fin_annee = scu.date_fin_anne_scolaire(annee_scolaire_int) fin_annee = scu.date_fin_anne_scolaire(annee_scolaire_int)
formsemestres = formsemestres.filter( formsemestres = formsemestres.filter(
@ -107,7 +107,7 @@ def formsemestres_query():
try: try:
dept_id = int(dept_id) dept_id = int(dept_id)
except ValueError: except ValueError:
abort(404, "invalid dept_id: not int") return error_response(404, "invalid dept_id: not int")
formsemestres = formsemestres.filter_by(dept_id=dept_id) formsemestres = formsemestres.filter_by(dept_id=dept_id)
return jsonify([formsemestre.to_dict_api() for formsemestre in formsemestres]) return jsonify([formsemestre.to_dict_api() for formsemestre in formsemestres])

View File

@ -212,7 +212,7 @@ def group_delete(group_id: int):
db.session.commit() db.session.commit()
app.set_sco_dept(group.partition.formsemestre.departement.acronym) app.set_sco_dept(group.partition.formsemestre.departement.acronym)
sco_cache.invalidate_formsemestre(formsemestre_id) sco_cache.invalidate_formsemestre(formsemestre_id)
return jsonify({"OK": 1}) return jsonify({"OK": True})
@bp.route("/group/<int:group_id>/edit", methods=["POST"]) @bp.route("/group/<int:group_id>/edit", methods=["POST"])
@ -402,4 +402,4 @@ def partition_delete(partition_id: int):
sco_cache.invalidate_formsemestre(formsemestre.id) sco_cache.invalidate_formsemestre(formsemestre.id)
if is_parcours: if is_parcours:
formsemestre.update_inscriptions_parcours_from_groups() formsemestre.update_inscriptions_parcours_from_groups()
return jsonify({"OK": 1}) return jsonify({"OK": True})