diff ape.js @ 690:657d63ab4458

Updated SMC Paper to reflect comments. Fixed bug in ape where no comment boxes crashed data collection.
author Nicholas Jillings <nicholas.jillings@eecs.qmul.ac.uk>
date Wed, 22 Apr 2015 10:45:08 +0100
parents f996a6663907
children 06fbaccf3b58
line wrap: on
line diff
--- a/ape.js	Tue Apr 21 21:35:23 2015 +0100
+++ b/ape.js	Wed Apr 22 10:45:08 2015 +0100
@@ -814,6 +814,13 @@
 	// Saves a specific test page
 	var xmlDoc = currentTestHolder;
 	// Check if any session wide metrics are enabled
+	
+	var commentShow = testXMLSetups[testId].attributes['elementComments'];
+	if (commentShow != undefined) {
+		if (commentShow.value == 'false') {commentShow = false;}
+		else {commentShow = true;}
+	} else {commentShow = true;}
+	
 	var metric = document.createElement('metric');
 	if (audioEngineContext.metric.enableTestTimer)
 	{
@@ -832,15 +839,17 @@
 		audioElement.url = currentTrackOrder[i].attributes['url'].value;
 		var value = document.createElement('value');
 		value.innerHTML = convSliderPosToRate(i);
-		var comment = document.createElement("comment");
-		var question = document.createElement("question");
-		var response = document.createElement("response");
-		question.textContent = commentObjects[i].children[0].textContent;
-		response.textContent = commentObjects[i].children[2].value;
-		comment.appendChild(question);
-		comment.appendChild(response);
+		if (commentShow) {
+			var comment = document.createElement("comment");
+			var question = document.createElement("question");
+			var response = document.createElement("response");
+			question.textContent = commentObjects[i].children[0].textContent;
+			response.textContent = commentObjects[i].children[2].value;
+			comment.appendChild(question);
+			comment.appendChild(response);
+			audioElement.appendChild(comment);
+		}
 		audioElement.appendChild(value);
-		audioElement.appendChild(comment);
 		// Check for any per element metrics
 		var metric = document.createElement('metric');
 		var elementMetric = audioEngineContext.audioObjects[i].metric;
@@ -925,5 +934,4 @@
 	xmlDoc.appendChild(postTestQuestions);
 	
 	return xmlDoc;
-}
-
+}
\ No newline at end of file