Mercurial > hg > webaudioevaluationtool
changeset 297:a8db8084d32a Dev_main
Feature #1298: <setup> node has an optional attribute testPages. Specify the number of pages the test participant to do and the tool will select a random page up to the number specified.
author | Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk> |
---|---|
date | Thu, 10 Sep 2015 13:16:16 +0100 |
parents | d3d691e33fec |
children | 5aaf26e925fb |
files | core.js example_eval/project.xml |
diffstat | 2 files changed, 34 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/core.js Thu Sep 10 12:53:55 2015 +0100 +++ b/core.js Thu Sep 10 13:16:16 2015 +0100 @@ -549,16 +549,6 @@ specification.decode(); testState.stateMap.push(specification.preTest); - - // New check if we need to randomise the test order - if (specification.randomiseOrder) - { - specification.audioHolders = randomiseOrder(specification.audioHolders); - for (var i=0; i<specification.audioHolders.length; i++) - { - specification.audioHolders[i].presentedId = i; - } - } $(specification.audioHolders).each(function(index,elem){ testState.stateMap.push(elem); @@ -1332,6 +1322,7 @@ this.projectReturn; this.randomiseOrder; this.collectMetrics; + this.testPages; this.preTest; this.postTest; this.metrics =[]; @@ -1344,12 +1335,20 @@ var setupNode = projectXML.getElementsByTagName('setup')[0]; this.interfaceType = setupNode.getAttribute('interface'); this.projectReturn = setupNode.getAttribute('projectReturn'); + this.testPages = setupNode.getAttribute('testPages'); if (setupNode.getAttribute('randomiseOrder') == "true") { this.randomiseOrder = true; } else {this.randomiseOrder = false;} if (setupNode.getAttribute('collectMetrics') == "true") { this.collectMetrics = true; } else {this.collectMetrics = false;} + if (isNaN(Number(this.testPages)) || this.testPages == undefined) + { + this.testPages = null; + } else { + this.testPages = Number(this.testPages); + if (this.testPages == 0) {this.testPages = null;} + } var metricCollection = setupNode.getElementsByTagName('Metric'); this.preTest = new this.prepostNode('pretest',setupNode.getElementsByTagName('PreTest')); @@ -1416,6 +1415,30 @@ this.audioHolders.push(new this.audioHolderNode(this,audioHolders[i])); } + // New check if we need to randomise the test order + if (this.randomiseOrder) + { + this.audioHolders = randomiseOrder(this.audioHolders); + for (var i=0; i<this.audioHolders.length; i++) + { + this.audioHolders[i].presentedId = i; + } + } + + if (this.testPages != null || this.testPages != undefined) + { + if (this.testPages > audioHolders.length) + { + console.log('Warning: You have specified '+audioHolders.length+' tests but requested '+this.testPages+' be completed!'); + this.testPages = audioHolders.length; + } + var aH = this.audioHolders; + this.audioHolders = []; + for (var i=0; i<this.testPages; i++) + { + this.audioHolders.push(aH[i]); + } + } }; this.prepostNode = function(type,Collection) {
--- a/example_eval/project.xml Thu Sep 10 12:53:55 2015 +0100 +++ b/example_eval/project.xml Thu Sep 10 13:16:16 2015 +0100 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <BrowserEvalProjectDocument> - <setup interface="APE" projectReturn="save.php" randomiseOrder='true' collectMetrics='true'> + <setup interface="APE" projectReturn="save.php" randomiseOrder='true' collectMetrics='true' testPages="1"> <PreTest> <question id="Location" mandatory="true" boxsize="large">Please enter your location.</question> <checkbox id="experience"> @@ -35,9 +35,6 @@ <metricEnable>elementListenTracker</metricEnable> </Metric> <interface> - <!--<check name="fragmentPlayed"/> - <check name="fragmentFullPlayback"/> - <check name="fragmentComments"/>--> <check name="fragmentMoved"/> <check name="scalerange" min="25" max="75"/> <option name='playhead'/> @@ -59,12 +56,6 @@ <audioElements url="2.wav" id="2"/> <audioElements url="3.wav" id="3"/> <audioElements url="4.wav" id="4"/> - <!--<audioElements url="5.wav" id="5"/> - <audioElements url="6.wav" id="6"/> - <audioElements url="7.wav" id="7"/> - <audioElements url="8.wav" id="8"/> - <audioElements url="9.wav" id="9"/> - <audioElements url="10.wav" id="10"/>--> <CommentQuestion id='mixingExperience' type="text">What is your mixing experience</CommentQuestion> <CommentQuestion id="preference" type="radio"> <statement>Please enter your ranking preference on this song</statement> @@ -104,10 +95,6 @@ <audioElements url="4.wav" id="4"/> <audioElements url="5.wav" id="5"/> <audioElements url="6.wav" id="6" type="outsidereference"/> - <!-- <audioElements url="7.wav" id="7"/> - <audioElements url="8.wav" id="8"/> - <audioElements url="9.wav" id="9"/> - <audioElements url="10.wav" id="10"/>--> <CommentQuestion id='mixingExperience' type="text">What is your mixing experience?</CommentQuestion> <CommentQuestion id="preference" type="radio"> <statement>Please enter your ranking preference on this song.</statement>