changeset 2253:2cc2eba252b4

Merge branch 'master' of https://github.com/BrechtDeMan/WebAudioEvaluationTool
author www-data <www-data@sucuk.dcs.qmul.ac.uk>
date Tue, 19 Apr 2016 16:20:49 +0100
parents cd1126365aa3 (current diff) aa36a634c8a6 (diff)
children 4fe7b04dc3fa
files
diffstat 2 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/analysis/analysis.js	Tue Apr 19 15:21:11 2016 +0100
+++ b/analysis/analysis.js	Tue Apr 19 16:20:49 2016 +0100
@@ -774,7 +774,14 @@
                     break;
             }
         }
-        for (var survey_entry of specification.preTest.options.concat(specification.postTest.options)) {
+        var options = [];
+        if(specification.preTest) {
+            options = options.concat(specification.preTest.options);
+        }
+        if (specification.postTest) {
+            options = options.concat(specification.postTest.options);
+        }
+        for (var survey_entry of options) {
             switch(survey_entry.type) {
                 case "number":
                 case "radio":
--- a/js/specification.js	Tue Apr 19 15:21:11 2016 +0100
+++ b/js/specification.js	Tue Apr 19 16:20:49 2016 +0100
@@ -356,11 +356,11 @@
 			var scaleParent = xml.getElementsByTagName('scales');
 			if (scaleParent.length == 1) {
 				scaleParent = scaleParent[0];
-				for (var i=0; i<scaleParent.children.length; i++) {
-					var child = scaleParent.children[i];
+                var scalelabels = scaleParent.getAllElementsByTagName('scalelabel');
+				for (var i=0; i<scalelabels.length; i++) {
 					this.scales.push({
-						text: child.textContent,
-						position: Number(child.getAttribute('position'))
+						text: scalelabels[i].textContent,
+						position: Number(scalelabels[i].getAttribute('position'))
 					});
 				}
 			}