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

Deleting a feedback option in a finalized exam will throw an error

parent 41992003
No related branches found
No related tags found
1 merge request!12Fix relation between MultipleChoiceOption and FeedbackOption
Pipeline #17725 passed
This commit is part of merge request !12. Comments created here will be created in the context of that merge request.
......@@ -140,14 +140,11 @@ class Feedback(Resource):
db.session.commit()
# Delete mc_options associated with this feedback option
if fb.mc_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
# 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()
db.session.delete(fb.mc_option)
db.session.commit()
return dict(status=200, message=f"Feedback option with id {feedback_id} deleted."), 200
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