diff --git a/zesje/api/feedback.py b/zesje/api/feedback.py index 01c2e98e529dca433b5fbf15783d8693134418d9..630ac52aa9e7964f5d4b67c056bee05b6b06e31e 100644 --- a/zesje/api/feedback.py +++ b/zesje/api/feedback.py @@ -125,6 +125,9 @@ class Feedback(Resource): problem = fb.problem if problem.id != problem_id: return dict(status=409, message="Feedback does not match the problem."), 409 + if 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) @@ -141,10 +144,6 @@ class Feedback(Resource): # Delete mc_options associated with this feedback option 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()