changeset 2775:87d71c41c174

#145. Added survey node duration to results
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Fri, 21 Apr 2017 14:09:08 +0100
parents 2fc62a50d593
children d6e496b0a5a9
files js/core.js
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/js/core.js	Fri Apr 21 14:03:51 2017 +0100
+++ b/js/core.js	Fri Apr 21 14:09:08 2017 +0100
@@ -553,7 +553,7 @@
     this.currentIndex = null;
     this.node = null;
     this.store = null;
-    var lastNodeStart = undefined;
+    var lastNodeStart;
     $(window).keypress(function (e) {
         if (e.keyCode == 13 && popup.popup.style.visibility == 'visible') {
             console.log(e);
@@ -1118,6 +1118,7 @@
             interfaceContext.lightbox.post("Error", "Not enough time has elapsed, please wait "+(node.specification.minWait-timeDelta).toFixed(0)+" seconds");
             return;
         }
+        node.elapsedTime = timeDelta;
         if (node.specification.type == 'question') {
             // Must extract the question data
             pass = processQuestion.call(this, node);
@@ -3512,7 +3513,7 @@
             var clone = this.parent.root.cloneNode(true);
             hold.appendChild(clone);
             var saveURL = specification.returnURL + "php/save.php?key=" + this.key + "&saveFilenamePrefix=";
-            if (this.parent.filenamePrefix.length == 0) {
+            if (this.parent.filenamePrefix.length === 0) {
                 saveURL += "save";
             } else {
                 saveURL += this.parent.filenamePrefix;
@@ -3605,6 +3606,7 @@
                 }
                 surveyresult = surveyresult.nextElementSibling;
             }
+            surveyresult.setAttribute("duration", node.elapsedTime);
             switch (node.specification.type) {
                 case "number":
                 case "question":