Commit f94d3663 by Tim Krones

MRQ: Don't error out if there are no results for current user.

parent 0a00f806
......@@ -221,7 +221,9 @@ function MRQBlock(runtime, element) {
display_message(result.message, messageView, options.checkmark);
}
$.each(result.choices, function(index, choice) {
// If user has never submitted an answer for this MRQ, `result` will be empty.
// So we need to fall back on an empty list for `result.choices` to avoid errors in the next step:
$.each(result.choices || [], function(index, choice) {
var choiceInputDOM = $('.choice input[value='+choice.value+']', element);
var choiceDOM = choiceInputDOM.closest('.choice');
var choiceResultDOM = $('.choice-result', choiceDOM);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment