changeset 2349:ceaccbd708cb

Hotfix: APE sticky markers should be fixed now. Caused by improper indexing of metric trackers if outside-reference was not at the end.
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Mon, 16 May 2016 13:30:41 +0100
parents 7de03d416f38
children 1ab42e36b6c8 ce406455f25b
files interfaces/ape.js js/core.js
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/interfaces/ape.js	Mon May 16 10:48:29 2016 +0100
+++ b/interfaces/ape.js	Mon May 16 13:30:41 2016 +0100
@@ -351,7 +351,7 @@
 	currentTestHolder = document.createElement('audioHolder');
 	currentTestHolder.id = audioHolderObject.id;
 	currentTestHolder.repeatCount = audioHolderObject.repeatCount;
-	
+    
 	// Find all the audioElements from the audioHolder
 	$(audioHolderObject.audioElements).each(function(index,element){
 		// Find URL of track
--- a/js/core.js	Mon May 16 10:48:29 2016 +0100
+++ b/js/core.js	Mon May 16 13:30:41 2016 +0100
@@ -1085,10 +1085,20 @@
 			if (this.currentStateMap == null)
 			{
 				this.currentStateMap = this.stateMap[this.stateIndex];
+                // Find and extract the outside reference
+                var elements = [], ref = null;
+                for (var elem of this.currentStateMap.audioElements) {
+                    if (elem.type == "outside-reference") {ref = elem;}
+                    else {elements.push(elem);}
+                }
 				if (this.currentStateMap.randomiseOrder)
 				{
-					this.currentStateMap.audioElements = randomiseOrder(this.currentStateMap.audioElements);
+					this.currentStateMap.audioElements = randomiseOrder(elements);
 				}
+                if (ref != null)
+                {
+                    this.currentStateMap.audioElements.push(ref);
+                }
                 this.currentStore = storage.testPages[this.stateIndex];
 				if (this.currentStateMap.preTest != null)
 				{