Commit e620e818 by Alan Boudreault

strictly compare strings

parent 781bc91b
...@@ -52,15 +52,15 @@ function MCQBlock(runtime, element) { ...@@ -52,15 +52,15 @@ function MCQBlock(runtime, element) {
choiceTipsCloseDOM; choiceTipsCloseDOM;
choiceResultDOM.removeClass('incorrect icon-exclamation correct icon-ok'); choiceResultDOM.removeClass('incorrect icon-exclamation correct icon-ok');
if (result.completed && choiceInputDOM.val() == result.submission) { if (result.completed && choiceInputDOM.val() === result.submission) {
choiceResultDOM.addClass('correct icon-ok'); choiceResultDOM.addClass('correct icon-ok');
} }
else if (choiceInputDOM.val() == result.submission || _.isNull(result.submission)) { else if (choiceInputDOM.val() === result.submission || _.isNull(result.submission)) {
choiceResultDOM.addClass('incorrect icon-exclamation'); choiceResultDOM.addClass('incorrect icon-exclamation');
} }
var tips = _.find(result.tips, function(obj) { var tips = _.find(result.tips, function(obj) {
return obj.choice == choiceInputDOM.val(); return obj.choice === choiceInputDOM.val();
}); });
if (tips) { if (tips) {
choiceTipsDOM.html(tips.tips); choiceTipsDOM.html(tips.tips);
...@@ -80,7 +80,7 @@ function MCQBlock(runtime, element) { ...@@ -80,7 +80,7 @@ function MCQBlock(runtime, element) {
} }
else if (result.tips) { else if (result.tips) {
var tips = _.find(result.tips, function(obj) { var tips = _.find(result.tips, function(obj) {
return obj.choice == result.submission; return obj.choice === result.submission;
}); });
if (tips) { if (tips) {
messageView.showMessage(tips.tips); messageView.showMessage(tips.tips);
......
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