comparison js/core.js @ 2697:67db38680bc0

Fixed fault hidden anchor and hidden reference marker checks
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Mon, 13 Mar 2017 10:46:31 +0000
parents 211364181d16
children 0562dcdfd5eb
comparison
equal deleted inserted replaced
2696:2edf2fc6755c 2697:67db38680bc0
3142 3142
3143 3143
3144 // Global Checkers 3144 // Global Checkers
3145 // These functions will help enforce the checkers 3145 // These functions will help enforce the checkers
3146 this.checkHiddenAnchor = function () { 3146 this.checkHiddenAnchor = function () {
3147 audioEngineContext.audioObjects.forEach(function (ao) { 3147 var anchors = audioEngineContext.audioObjects.filter(function (ao) {
3148 if (ao.specification.type === "anchor") { 3148 return ao.specification.type === "anchor";
3149 if (ao.interfaceDOM.getValue() > (ao.specification.marker / 100) && ao.specification.marker > 0) { 3149 });
3150 // Anchor is not set below 3150 var state = anchors.some(function (ao) {
3151 console.log('Anchor node not below marker value'); 3151 return (ao.interfaceDOM.getValue() > (ao.specification.marker / 100) && ao.specification.marker > 0);
3152 interfaceContext.lightbox.post("Message", 'Please keep listening'); 3152 });
3153 this.storeErrorNode('Anchor node not below marker value'); 3153 if (state) {
3154 return false; 3154 console.log('Anchor node not below marker value');
3155 } 3155 interfaceContext.lightbox.post("Message", 'Please keep listening');
3156 } 3156 this.storeErrorNode('Anchor node not below marker value');
3157 }, this); 3157 return false;
3158 }
3158 return true; 3159 return true;
3159 }; 3160 };
3160 3161
3161 this.checkHiddenReference = function () { 3162 this.checkHiddenReference = function () {
3162 audioEngineContext.audioObjects.forEach(function (ao) { 3163 var references = audioEngineContext.audioObjects.filter(function (ao) {
3163 if (ao.specification.type == "reference") { 3164 return ao.specification.type === "references";
3164 if (ao.interfaceDOM.getValue() < (ao.specification.marker / 100) && ao.specification.marker > 0) { 3165 });
3165 // Anchor is not set below 3166 var state = references.some(function (ao) {
3166 console.log('Reference node not above marker value'); 3167 return (ao.interfaceDOM.getValue() < (ao.specification.marker / 100) && ao.specification.marker > 0);
3167 this.storeErrorNode('Reference node not above marker value'); 3168 });
3168 interfaceContext.lightbox.post("Message", 'Please keep listening'); 3169 if (state) {
3169 return false; 3170 console.log('Reference node not below marker value');
3170 } 3171 interfaceContext.lightbox.post("Message", 'Please keep listening');
3171 } 3172 this.storeErrorNode('Reference node not below marker value');
3172 }, this); 3173 return false;
3174 }
3173 return true; 3175 return true;
3174 }; 3176 };
3175 3177
3176 this.checkFragmentsFullyPlayed = function () { 3178 this.checkFragmentsFullyPlayed = function () {
3177 // Checks the entire file has been played back 3179 // Checks the entire file has been played back