Each MultiplechoiceOption is linked to a Problem, but this link is redundant since each Problem can be linked to a FeedbackOption, which is already linked to a Problem.
Designs
Child items
...
Show closed items
Linked items
0
Link issues together to show that they're related.
Learn more.
There is a problem with the proposed change in this issue.
Currently the API call GET /exams/<id>, which fetches one exam, returns a rather large JSON object.
The JSON response currently looks like this
{'id':exam_id,'name':exam.name,'submissions':submissions,'problems':[{'id':prob.id,'name':prob.name,'feedback':[{'id':fb.id,'name':fb.text,'description':fb.description,'score':fb.score,'used':len(fb.solutions)}forfbinprob.feedback_options# Sorted by fb.id],'page':prob.widget.page,'widget':{'id':prob.widget.id,'name':prob.widget.name,'x':prob.widget.x,'y':prob.widget.y,'width':prob.widget.width,'height':prob.widget.height,},'graded':any([sol.graded_byisnotNoneforsolinprob.solutions])}forprobinexam.problems# Sorted by prob.id],'widgets':[{'id':widget.id,'name':widget.name,'x':widget.x,'y':widget.y,}forwidgetinexam.widgets# Sorted by widget.id],'finalized':exam.finalized,}
Ideally, after for example "widget", you would want to use a JSON notation that constructs an array of MultipleChoiceOptions with a notation like
[formc_optioninproblem.mc_options]
If the relationship between MultipleChoiceOption and Problem is removed, this would not be possible. This means that some query has to be written manually before the JSON is constructed, which may not be as efficient.
One way to resolve this issue is to add a relationship between FeedbackOption and MultipleChoiceOption (see also #35 (closed)), but then a notation like
[formc_optioninfeedback_option.mc_options]
would be very much redundant since the MultipleChoiceOptions are unique to a problem and not to a FeedbackOption.
If you add a relationship field mc_option to FeedbackOption using db.relationship, you can do something like the following: mc_option in [fb_option.mc_option for fb_option in problem.feedback_options if fb_option.mc_option]