Mercurial > hg > webaudioevaluationtool
comparison js/core.js @ 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 | 80c95ab21220 |
comparison
equal
deleted
inserted
replaced
2774:2fc62a50d593 | 2775:87d71c41c174 |
---|---|
551 this.buttonPrevious = null; | 551 this.buttonPrevious = null; |
552 this.popupOptions = null; | 552 this.popupOptions = null; |
553 this.currentIndex = null; | 553 this.currentIndex = null; |
554 this.node = null; | 554 this.node = null; |
555 this.store = null; | 555 this.store = null; |
556 var lastNodeStart = undefined; | 556 var lastNodeStart; |
557 $(window).keypress(function (e) { | 557 $(window).keypress(function (e) { |
558 if (e.keyCode == 13 && popup.popup.style.visibility == 'visible') { | 558 if (e.keyCode == 13 && popup.popup.style.visibility == 'visible') { |
559 console.log(e); | 559 console.log(e); |
560 popup.buttonProceed.onclick(); | 560 popup.buttonProceed.onclick(); |
561 e.preventDefault(); | 561 e.preventDefault(); |
1116 timeDelta = (new Date() - lastNodeStart)/1000.0; | 1116 timeDelta = (new Date() - lastNodeStart)/1000.0; |
1117 if (timeDelta < node.specification.minWait) { | 1117 if (timeDelta < node.specification.minWait) { |
1118 interfaceContext.lightbox.post("Error", "Not enough time has elapsed, please wait "+(node.specification.minWait-timeDelta).toFixed(0)+" seconds"); | 1118 interfaceContext.lightbox.post("Error", "Not enough time has elapsed, please wait "+(node.specification.minWait-timeDelta).toFixed(0)+" seconds"); |
1119 return; | 1119 return; |
1120 } | 1120 } |
1121 node.elapsedTime = timeDelta; | |
1121 if (node.specification.type == 'question') { | 1122 if (node.specification.type == 'question') { |
1122 // Must extract the question data | 1123 // Must extract the question data |
1123 pass = processQuestion.call(this, node); | 1124 pass = processQuestion.call(this, node); |
1124 } else if (node.specification.type == 'checkbox') { | 1125 } else if (node.specification.type == 'checkbox') { |
1125 // Must extract checkbox data | 1126 // Must extract checkbox data |
3510 this.parent.finish(); | 3511 this.parent.finish(); |
3511 var hold = document.createElement("div"); | 3512 var hold = document.createElement("div"); |
3512 var clone = this.parent.root.cloneNode(true); | 3513 var clone = this.parent.root.cloneNode(true); |
3513 hold.appendChild(clone); | 3514 hold.appendChild(clone); |
3514 var saveURL = specification.returnURL + "php/save.php?key=" + this.key + "&saveFilenamePrefix="; | 3515 var saveURL = specification.returnURL + "php/save.php?key=" + this.key + "&saveFilenamePrefix="; |
3515 if (this.parent.filenamePrefix.length == 0) { | 3516 if (this.parent.filenamePrefix.length === 0) { |
3516 saveURL += "save"; | 3517 saveURL += "save"; |
3517 } else { | 3518 } else { |
3518 saveURL += this.parent.filenamePrefix; | 3519 saveURL += this.parent.filenamePrefix; |
3519 } | 3520 } |
3520 return new Promise(function (resolve, reject) { | 3521 return new Promise(function (resolve, reject) { |
3603 if (surveyresult.getAttribute("ref") == node.specification.id) { | 3604 if (surveyresult.getAttribute("ref") == node.specification.id) { |
3604 break; | 3605 break; |
3605 } | 3606 } |
3606 surveyresult = surveyresult.nextElementSibling; | 3607 surveyresult = surveyresult.nextElementSibling; |
3607 } | 3608 } |
3609 surveyresult.setAttribute("duration", node.elapsedTime); | |
3608 switch (node.specification.type) { | 3610 switch (node.specification.type) { |
3609 case "number": | 3611 case "number": |
3610 case "question": | 3612 case "question": |
3611 case "slider": | 3613 case "slider": |
3612 surveyresult.appendChild(postNumber(this.parent.document, node.response)); | 3614 surveyresult.appendChild(postNumber(this.parent.document, node.response)); |