From 9d872d4ff6c1666526e608647536e053bdcbaaab Mon Sep 17 00:00:00 2001 From: Isaiah Mayerchak Date: Tue, 5 Jul 2016 20:25:44 -0500 Subject: [PATCH 1/3] Logging answer for act instead of 'submitMC' --- runestone/assess/js/mchoice.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runestone/assess/js/mchoice.js b/runestone/assess/js/mchoice.js index 52b07b0f0..4fe477bc6 100644 --- a/runestone/assess/js/mchoice.js +++ b/runestone/assess/js/mchoice.js @@ -387,7 +387,7 @@ MultipleChoice.prototype.scoreMCMASubmission = function () { MultipleChoice.prototype.logMCMAsubmission = function (data) { var answer = data.answer; var correct = data.correct; - this.logBookEvent({"event": "mChoice", "act": "submitMC", "answer": answer, "correct": correct, "div_id": this.divid}); + this.logBookEvent({"event": "mChoice", "act": answer, "answer": answer, "correct": correct, "div_id": this.divid}); }; @@ -439,7 +439,7 @@ MultipleChoice.prototype.scoreMCMFSubmission = function () { MultipleChoice.prototype.logMCMFsubmission = function () { var answer = this.givenArray[0]; var correct = (this.givenArray[0] == this.correctIndexList[0] ? "T" : "F"); - this.logBookEvent({"event": "mChoice", "act": "submitMC", "answer": answer, "correct": correct, "div_id": this.divid}); + this.logBookEvent({"event": "mChoice", "act": answer, "answer": answer, "correct": correct, "div_id": this.divid}); }; MultipleChoice.prototype.renderMCMFFeedback = function (correct, feedbackText) { From da6c43cbe90f414afa983124c0ec737c6d107176 Mon Sep 17 00:00:00 2001 From: Isaiah Mayerchak Date: Tue, 5 Jul 2016 22:22:54 -0500 Subject: [PATCH 2/3] Changed logging to use only 'act' which records answers --- runestone/assess/js/fitb.js | 4 ++-- runestone/assess/js/mchoice.js | 4 ++-- runestone/dragndrop/js/dragndrop.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/runestone/assess/js/fitb.js b/runestone/assess/js/fitb.js index cefe8a8bd..d53eea5e9 100644 --- a/runestone/assess/js/fitb.js +++ b/runestone/assess/js/fitb.js @@ -219,7 +219,7 @@ FITB.prototype.checkLocalStorage = function () { $(this.blankArray[i]).attr("value", arr[i]); } if (this.useRunestoneServices) { - this.logBookEvent({"event": "fillb", "act": "submitFITB", "answer": storedData.answer.join(","), "correct": storedData.correct, "div_id": this.divid}); + this.logBookEvent({"event": "fillb", "act": storedData.answer.join(","), "correct": storedData.correct, "div_id": this.divid}); this.enableCompareButton(); } } @@ -250,7 +250,7 @@ FITB.prototype.startEvaluation = function (logFlag) { this.evaluateAnswers(); this.renderFITBFeedback(); if (logFlag) { // Sometimes we don't want to log the answer--for example, when timed exam questions are re-loaded - this.logBookEvent({"event": "fillb", "act": "submitFITB", "answer": this.given_arr.join(","), "correct": (this.correct ? "T" : "F"), "div_id": this.divid}); + this.logBookEvent({"event": "fillb", "act": this.given_arr.join(","), "correct": (this.correct ? "T" : "F"), "div_id": this.divid}); } if (this.useRunestoneServices) { this.enableCompareButton(); diff --git a/runestone/assess/js/mchoice.js b/runestone/assess/js/mchoice.js index 4fe477bc6..9989a39a3 100644 --- a/runestone/assess/js/mchoice.js +++ b/runestone/assess/js/mchoice.js @@ -387,7 +387,7 @@ MultipleChoice.prototype.scoreMCMASubmission = function () { MultipleChoice.prototype.logMCMAsubmission = function (data) { var answer = data.answer; var correct = data.correct; - this.logBookEvent({"event": "mChoice", "act": answer, "answer": answer, "correct": correct, "div_id": this.divid}); + this.logBookEvent({"event": "mChoice", "act": answer, "correct": correct, "div_id": this.divid}); }; @@ -439,7 +439,7 @@ MultipleChoice.prototype.scoreMCMFSubmission = function () { MultipleChoice.prototype.logMCMFsubmission = function () { var answer = this.givenArray[0]; var correct = (this.givenArray[0] == this.correctIndexList[0] ? "T" : "F"); - this.logBookEvent({"event": "mChoice", "act": answer, "answer": answer, "correct": correct, "div_id": this.divid}); + this.logBookEvent({"event": "mChoice", "act": answer "correct": correct, "div_id": this.divid}); }; MultipleChoice.prototype.renderMCMFFeedback = function (correct, feedbackText) { diff --git a/runestone/dragndrop/js/dragndrop.js b/runestone/dragndrop/js/dragndrop.js index 089fad300..1c0adb2bb 100644 --- a/runestone/dragndrop/js/dragndrop.js +++ b/runestone/dragndrop/js/dragndrop.js @@ -337,7 +337,7 @@ DragNDrop.prototype.dragEval = function (logFlag) { this.setLocalStorage({"correct": (this.correct ? "T" : "F")}); this.renderFeedback(); if (logFlag) // Sometimes we don't want to log the answers--for example, on re-load of a timed exam - this.logBookEvent({"event": "dragNdrop", "act": "submitDND", "answer": this.pregnantIndexArray.join(";"), "minHeight": this.minheight, "div_id": this.divid, "correct": this.correct}); + this.logBookEvent({"event": "dragNdrop", "act": this.pregnantIndexArray.join(";"), "minHeight": this.minheight, "div_id": this.divid, "correct": this.correct}); }; DragNDrop.prototype.renderFeedback = function () { @@ -374,7 +374,7 @@ DragNDrop.prototype.checkLocalStorage = function () { this.pregnantIndexArray = storedObj.answer.split(";"); if (this.useRunestoneServices) { // store answer in database - this.logBookEvent({"event": "dragNdrop", "act": "submitDND", "answer": this.pregnantIndexArray.join(";"), "minHeight": this.minheight, "div_id": this.divid, "correct": storedObj.correct}); + this.logBookEvent({"event": "dragNdrop", "act": this.pregnantIndexArray.join(";"), "minHeight": this.minheight, "div_id": this.divid, "correct": storedObj.correct}); } } } From d678dd7972eae6a103175f70c24106863183e1c5 Mon Sep 17 00:00:00 2001 From: Brad Miller Date: Wed, 6 Jul 2016 07:03:55 -0500 Subject: [PATCH 3/3] backward compatible logging --- runestone/assess/js/fitb.js | 6 ++++-- runestone/assess/js/mchoice.js | 6 ++++-- runestone/common/js/runestonebase.js | 4 ++-- runestone/dragndrop/js/dragndrop.js | 6 ++++-- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/runestone/assess/js/fitb.js b/runestone/assess/js/fitb.js index d53eea5e9..f9c9169b2 100644 --- a/runestone/assess/js/fitb.js +++ b/runestone/assess/js/fitb.js @@ -219,7 +219,8 @@ FITB.prototype.checkLocalStorage = function () { $(this.blankArray[i]).attr("value", arr[i]); } if (this.useRunestoneServices) { - this.logBookEvent({"event": "fillb", "act": storedData.answer.join(","), "correct": storedData.correct, "div_id": this.divid}); + var answer = storedData.answer.join(",") + this.logBookEvent({"event": "fillb", "act": answer, "answer": answer, "correct": storedData.correct, "div_id": this.divid}); this.enableCompareButton(); } } @@ -250,7 +251,8 @@ FITB.prototype.startEvaluation = function (logFlag) { this.evaluateAnswers(); this.renderFITBFeedback(); if (logFlag) { // Sometimes we don't want to log the answer--for example, when timed exam questions are re-loaded - this.logBookEvent({"event": "fillb", "act": this.given_arr.join(","), "correct": (this.correct ? "T" : "F"), "div_id": this.divid}); + var answer = this.given_arr.join(","); + this.logBookEvent({"event": "fillb", "act": answer, "answer":answer, "correct": (this.correct ? "T" : "F"), "div_id": this.divid}); } if (this.useRunestoneServices) { this.enableCompareButton(); diff --git a/runestone/assess/js/mchoice.js b/runestone/assess/js/mchoice.js index 9989a39a3..f030b4f41 100644 --- a/runestone/assess/js/mchoice.js +++ b/runestone/assess/js/mchoice.js @@ -387,7 +387,8 @@ MultipleChoice.prototype.scoreMCMASubmission = function () { MultipleChoice.prototype.logMCMAsubmission = function (data) { var answer = data.answer; var correct = data.correct; - this.logBookEvent({"event": "mChoice", "act": answer, "correct": correct, "div_id": this.divid}); + var logAnswer = "answer:" + answer + ":" + (correct == "T" ? "correct" : "no"); + this.logBookEvent({"event": "mChoice", "act": logAnswer, "answer":answer, "correct": correct, "div_id": this.divid}); }; @@ -439,7 +440,8 @@ MultipleChoice.prototype.scoreMCMFSubmission = function () { MultipleChoice.prototype.logMCMFsubmission = function () { var answer = this.givenArray[0]; var correct = (this.givenArray[0] == this.correctIndexList[0] ? "T" : "F"); - this.logBookEvent({"event": "mChoice", "act": answer "correct": correct, "div_id": this.divid}); + var logAnswer = "answer:" + answer + ":" + (correct == "T" ? "correct" : "no"); // backward compatible + this.logBookEvent({"event": "mChoice", "act": logAnswer, "answer": answer, "correct": correct, "div_id": this.divid}); }; MultipleChoice.prototype.renderMCMFFeedback = function (correct, feedbackText) { diff --git a/runestone/common/js/runestonebase.js b/runestone/common/js/runestonebase.js index b30035ecb..703d8538c 100644 --- a/runestone/common/js/runestonebase.js +++ b/runestone/common/js/runestonebase.js @@ -7,7 +7,7 @@ RunestoneBase.prototype.logBookEvent = function (eventInfo) { if (eBookConfig.useRunestoneServices && eBookConfig.logLevel > 0) { jQuery.get(eBookConfig.ajaxURL + 'hsblog', eventInfo); // Log the run event } - console.log("logging event " + eventInfo); + console.log("logging event " + JSON.stringify(eventInfo)); }; RunestoneBase.prototype.logRunEvent = function (eventInfo) { @@ -18,7 +18,7 @@ RunestoneBase.prototype.logRunEvent = function (eventInfo) { if (eBookConfig.useRunestoneServices && eBookConfig.logLevel > 0) { jQuery.post(eBookConfig.ajaxURL + 'runlog', eventInfo); // Log the run event } - console.log("running " + eventInfo); + console.log("running " + JSON.stringify(eventInfo)); }; /* Checking/loading from storage */ diff --git a/runestone/dragndrop/js/dragndrop.js b/runestone/dragndrop/js/dragndrop.js index 1c0adb2bb..75ef588ec 100644 --- a/runestone/dragndrop/js/dragndrop.js +++ b/runestone/dragndrop/js/dragndrop.js @@ -337,7 +337,8 @@ DragNDrop.prototype.dragEval = function (logFlag) { this.setLocalStorage({"correct": (this.correct ? "T" : "F")}); this.renderFeedback(); if (logFlag) // Sometimes we don't want to log the answers--for example, on re-load of a timed exam - this.logBookEvent({"event": "dragNdrop", "act": this.pregnantIndexArray.join(";"), "minHeight": this.minheight, "div_id": this.divid, "correct": this.correct}); + var answer = this.pregnantIndexArray.join(";"); + this.logBookEvent({"event": "dragNdrop", "act": answer, "answer":answer, "minHeight": this.minheight, "div_id": this.divid, "correct": this.correct}); }; DragNDrop.prototype.renderFeedback = function () { @@ -374,7 +375,8 @@ DragNDrop.prototype.checkLocalStorage = function () { this.pregnantIndexArray = storedObj.answer.split(";"); if (this.useRunestoneServices) { // store answer in database - this.logBookEvent({"event": "dragNdrop", "act": this.pregnantIndexArray.join(";"), "minHeight": this.minheight, "div_id": this.divid, "correct": storedObj.correct}); + var answer = this.pregnantIndexArray.join(";"); + this.logBookEvent({"event": "dragNdrop", "act": answer, "answer":answer, "minHeight": this.minheight, "div_id": this.divid, "correct": storedObj.correct}); } } }