From 3e15bec9effde09a6f51663ec778dd668965aac8 Mon Sep 17 00:00:00 2001 From: Ruben Young On <r.d.youngon@student.tudelft.nl> Date: Sun, 19 May 2019 13:14:47 +0200 Subject: [PATCH] MultipleChoiceOption is now deleted if the related FeedbackOption is deleted --- zesje/api/feedback.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zesje/api/feedback.py b/zesje/api/feedback.py index 6475bad4..f81ef406 100644 --- a/zesje/api/feedback.py +++ b/zesje/api/feedback.py @@ -138,3 +138,10 @@ class Feedback(Resource): solution.graded_at = None db.session.commit() + + # Delete mc_options associated with this feedback option + if fb.mc_option: + db.session.delete(fb.mc_option) + db.session.commit() + + return dict(status=200, message=f"Feedback option with id {feedback_id} deleted."), 200 -- GitLab