forked from ScoDoc/ScoDoc
API: erreurs sans abort() + fix ok:true
This commit is contained in:
parent
26454de0c4
commit
692c5b0369
@ -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])
|
||||||
|
@ -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})
|
||||||
|
Loading…
Reference in New Issue
Block a user