Mercurial > hg > webaudioevaluationtool
comparison js/core.js @ 2826:28a5504db337
#209 define interfaceContext.checkFragmentMinPlays
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Tue, 09 May 2017 15:40:37 +0100 |
parents | 25027b8665a2 |
children | cf1a3a529177 |
comparison
equal
deleted
inserted
replaced
2825:64a5603831e2 | 2826:28a5504db337 |
---|---|
3331 } | 3331 } |
3332 interfaceContext.lightbox.post("Error", str); | 3332 interfaceContext.lightbox.post("Error", str); |
3333 } | 3333 } |
3334 return state; | 3334 return state; |
3335 }; | 3335 }; |
3336 this.checkFragmentMinPlays = function () { | |
3337 var failedObjects = audioEngineContext.audioObjects.filter(function (a) { | |
3338 var minPlays = a.specification.minNumberPlays || a.specification.parent.minNumberPlays || specification.minNumberPlays; | |
3339 if (minPlays === undefined || a.numberOfPlays >= minPlays) { | |
3340 return false; | |
3341 } | |
3342 return true; | |
3343 }); | |
3344 if (failedObjects.length === 0) { | |
3345 return false; | |
3346 } | |
3347 var failedString = []; | |
3348 failedObjects.forEach(function (a) { | |
3349 failedString.push(a.interfaceDOM.getPresentedId()); | |
3350 }); | |
3351 var str = "You have not played fragments " + failedString.join(", ") + " enough. Please keep listening"; | |
3352 interfaceContext.lightbox.post("Message", str); | |
3353 this.storeErrorNode(str); | |
3354 return true; | |
3355 }; | |
3356 | |
3336 | 3357 |
3337 this.storeErrorNode = function (errorMessage) { | 3358 this.storeErrorNode = function (errorMessage) { |
3338 var time = audioEngineContext.timer.getTestTime(); | 3359 var time = audioEngineContext.timer.getTestTime(); |
3339 var node = storage.document.createElement('error'); | 3360 var node = storage.document.createElement('error'); |
3340 node.setAttribute('time', time); | 3361 node.setAttribute('time', time); |