Skip to content
Snippets Groups Projects
Commit 41992003 authored by Ruben Young On's avatar Ruben Young On
Browse files

Deleting a feedback option will throw an error if it is associated with an...

Deleting a feedback option will throw an error if it is associated with an mc_option in a finalized exam
parent 5b73e83f
No related branches found
No related tags found
1 merge request!12Fix relation between MultipleChoiceOption and FeedbackOption
Pipeline #17724 passed
This commit is part of merge request !12. Comments created here will be created in the context of that merge request.
......@@ -141,6 +141,12 @@ class Feedback(Resource):
# Delete mc_options associated with this feedback option
if fb.mc_option:
# Check if the exam with this feedback 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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment