From 9151d76d45f7e8b95b3d6423cb88b73060f59409 Mon Sep 17 00:00:00 2001 From: Ruben Young On <r.d.youngon@student.tudelft.nl> Date: Sun, 19 May 2019 14:23:30 +0200 Subject: [PATCH] Added fix for deleting feedback option --- zesje/api/feedback.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/zesje/api/feedback.py b/zesje/api/feedback.py index 686afb51..01c2e98e 100644 --- a/zesje/api/feedback.py +++ b/zesje/api/feedback.py @@ -140,11 +140,12 @@ class Feedback(Resource): db.session.commit() # Delete mc_options associated with this feedback option - if fb.mc_option and fb.problem.exam.finalized: - return dict(status=401, message='Cannot delete feedback option' - + ' attached to a multiple choice option in a finalized exam.'), 401 + if fb.mc_option: + if fb.problem.exam.finalized: + return dict(status=401, message='Cannot delete feedback option' + + ' attached to a multiple choice option in a finalized exam.'), 401 - db.session.delete(fb.mc_option) - db.session.commit() + db.session.delete(fb.mc_option) + db.session.commit() return dict(status=200, message=f"Feedback option with id {feedback_id} deleted."), 200 -- GitLab