Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug fixes:
- MCQ page, if there's no correct answer in options then the 'You answer is correct/incorrect' text won't show
- Quiz page, the main feedback text now only shows when quiz is complete

git-svn-id: https://xerteonlinetoolkits.googlecode.com/svn/trunk@888 912cdd6b-5c7d-d5a7-a2ba-d0f0cdb91641
  • Loading branch information
FayCross committed May 10, 2013
1 parent ec2370a commit 6cb805e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
30 changes: 18 additions & 12 deletions modules/xerte/parent_templates/Nottingham/models_html5/mcq.html
Expand Up @@ -78,7 +78,8 @@
//$optionTxt = $optionHolder.find(".optionTxt"),
correctOptions = [],
correctAnswer = [],
correctFeedback = [];
correctFeedback = [],
correctOption = false; // is there a correct answer for the question?

$(x_currentPageXML).children()
.each(function(i) {
Expand All @@ -96,6 +97,7 @@
correctOptions.push(i+1+"");
correctAnswer.push(this.getAttribute("text"));
correctFeedback.push(this.getAttribute("feedback"));
correctOption = true;
}

$thisOption
Expand Down Expand Up @@ -191,20 +193,24 @@
multiWrong = "You have not selected the correct combination of answers";
}

var rightWrongTxt;
var rightWrongTxt = "";
// add correct feedback depending on if question overall has been answered correctly or not
if (x_currentPageXML.getAttribute("type") == "Multiple Answer") {
if (correct == true) {
rightWrongTxt = '<p><br/>' + multiRight + '</p>';
} else {
rightWrongTxt = '<p><br/>' + multiWrong + '</p>';
}
if (correctOption == true) { // there is a correct answer for question
if (correct == true) {
rightWrongTxt = '<p><br/>' + multiRight + '</p>';
} else {
rightWrongTxt = '<p><br/>' + multiWrong + '</p>';
}
}
} else {
if (correct == true) {
rightWrongTxt = '<p><br/>' + singleRight + '</p>';
} else {
rightWrongTxt = '<p><br/>' + singleWrong + '</p>';
}
if (correctOption == true) { // there is a correct answer for question
if (correct == true) {
rightWrongTxt = '<p><br/>' + singleRight + '</p>';
} else {
rightWrongTxt = '<p><br/>' + singleWrong + '</p>';
}
}
}
generalFeedback += rightWrongTxt;
var feedbackLabel = x_currentPageXML.getAttribute("feedbackLabel");
Expand Down
Expand Up @@ -168,7 +168,6 @@
}

this.showResults = function() {

// last question answered - show results
var $pageContents = $("#pageContents");
$("#qNo").html($pageContents.data("onCompletionText"));
Expand Down Expand Up @@ -337,9 +336,6 @@
l_feedback = [];

var generalFeedback = "";
if (x_currentPageXML.getAttribute("feedback") != undefined) {
generalFeedback = "<p>" + x_addLineBreaks(x_currentPageXML.getAttribute("feedback")) + "</p>";
}

// get feedback for selected options and check if they are correct
for (var i=0; i<selected.length; i++) {
Expand Down

0 comments on commit 6cb805e

Please sign in to comment.