From 3ea976062da1ca2a96a87bf4ee3dc0f539c1637b Mon Sep 17 00:00:00 2001 From: ericsonga Date: Wed, 27 Jan 2016 12:09:49 -0500 Subject: [PATCH 1/4] Fix to fill in the blank logging of correct answers The fill in the blank correct answers were being logged as incorrect due to checking the wrong flag --- runestone/assess/js/fitb.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runestone/assess/js/fitb.js b/runestone/assess/js/fitb.js index 192f81f03..41640494a 100644 --- a/runestone/assess/js/fitb.js +++ b/runestone/assess/js/fitb.js @@ -250,7 +250,7 @@ FITB.prototype.checkFITBStorage = function () { // Starts chain of functions which ends with feedBack() displaying feedback to user this.evaluateAnswers(); this.renderFITBFeedback(); - var answerInfo = "answer:" + this.given_arr + ":" + (this.isCorrect ? "correct" : "no"); + var answerInfo = "answer:" + this.given_arr + ":" + (this.correct ? "correct" : "no"); this.logBookEvent({"event": "fillb", "act": answerInfo, "div_id": this.divid}); this.enableCompareButton.disabled = false; }; From 06b454197ddf104b6987bac67c3151dcbb989d76 Mon Sep 17 00:00:00 2001 From: ericsonga Date: Wed, 27 Jan 2016 22:29:59 -0500 Subject: [PATCH 2/4] Fix for indention on Parsons problems with code blocks that need to be indented and are more than one line of code I added a line to remove the leading spaces for the 2nd and on lines of a code block that needs to be indented --- runestone/parsons/js/parsons.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runestone/parsons/js/parsons.js b/runestone/parsons/js/parsons.js index 0dbf640b9..fa5f49f27 100644 --- a/runestone/parsons/js/parsons.js +++ b/runestone/parsons/js/parsons.js @@ -799,6 +799,9 @@ if (codestring) { // Consecutive lines to be dragged as a single block of code have strings "\\n" to // represent newlines => replace them with actual new line characters "\n" + console.log(codestring); + codestring = codestring.replace(/\\n\s+/g,"\\n"); // remove leading spaced if more than one line in a code block + console.log(codestring); this.code = codestring.replace(/#distractor\s*$/, "").replace(trimRegexp, "$1").replace(/\\n/g, "\n"); this.indent = codestring.length - codestring.replace(/^\s+/, "").length; } From d041ad71135ed31dc20a48b6bb404adff3cdc57b Mon Sep 17 00:00:00 2001 From: ericsonga Date: Wed, 27 Jan 2016 22:31:53 -0500 Subject: [PATCH 3/4] removed console.log --- runestone/parsons/js/parsons.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/runestone/parsons/js/parsons.js b/runestone/parsons/js/parsons.js index fa5f49f27..3497e34b6 100644 --- a/runestone/parsons/js/parsons.js +++ b/runestone/parsons/js/parsons.js @@ -799,9 +799,7 @@ if (codestring) { // Consecutive lines to be dragged as a single block of code have strings "\\n" to // represent newlines => replace them with actual new line characters "\n" - console.log(codestring); codestring = codestring.replace(/\\n\s+/g,"\\n"); // remove leading spaced if more than one line in a code block - console.log(codestring); this.code = codestring.replace(/#distractor\s*$/, "").replace(trimRegexp, "$1").replace(/\\n/g, "\n"); this.indent = codestring.length - codestring.replace(/^\s+/, "").length; } From 391e8df6624cf3fdf0331bf8866dded04280ef14 Mon Sep 17 00:00:00 2001 From: ericsonga Date: Thu, 28 Jan 2016 09:57:56 -0500 Subject: [PATCH 4/4] Moved the code to get rid of leading spaces so that the code string isn't changed I moved the code that I had added to the next line to not change the codestring. --- runestone/parsons/js/parsons.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runestone/parsons/js/parsons.js b/runestone/parsons/js/parsons.js index 3497e34b6..42a82764d 100644 --- a/runestone/parsons/js/parsons.js +++ b/runestone/parsons/js/parsons.js @@ -799,8 +799,8 @@ if (codestring) { // Consecutive lines to be dragged as a single block of code have strings "\\n" to // represent newlines => replace them with actual new line characters "\n" - codestring = codestring.replace(/\\n\s+/g,"\\n"); // remove leading spaced if more than one line in a code block - this.code = codestring.replace(/#distractor\s*$/, "").replace(trimRegexp, "$1").replace(/\\n/g, "\n"); + //codestring = codestring.replace(/\\n\s+/g,"\\n"); // remove leading spaced if more than one line in a code block - added in below to not change the codestring + this.code = codestring.replace(/#distractor\s*$/, "").replace(trimRegexp, "$1").replace(/\\n\s+/g,"\\n").replace(/\\n+/g,"\n"); this.indent = codestring.length - codestring.replace(/^\s+/, "").length; } };