comparison js/core.js @ 3131:735d96d343f6

Fixed #287
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Thu, 21 Feb 2019 12:01:34 +0000
parents ebe6a4c98635
children bc0ef78bb07a
comparison
equal deleted inserted replaced
3130:ebe6a4c98635 3131:735d96d343f6
1158 } 1158 }
1159 }; 1159 };
1160 1160
1161 this.proceedClicked = function () { 1161 this.proceedClicked = function () {
1162 // Each time the popup button is clicked! 1162 // Each time the popup button is clicked!
1163 if (testState.stateIndex === -1 && specification.calibration) {
1164 advanceState();
1165 return;
1166 }
1167 var node = this.popupOptions[this.currentIndex], 1163 var node = this.popupOptions[this.currentIndex],
1168 pass = true, 1164 pass = true,
1169 timeDelta = (new Date() - lastNodeStart) / 1000.0; 1165 timeDelta = (new Date() - lastNodeStart) / 1000.0;
1166 if (node == undefined) {
1167 advanceState();
1168 }
1170 if (timeDelta < node.specification.minWait) { 1169 if (timeDelta < node.specification.minWait) {
1171 interfaceContext.lightbox.post("Error", "Not enough time has elapsed, please wait " + (node.specification.minWait - timeDelta).toFixed(0) + " seconds"); 1170 interfaceContext.lightbox.post("Error", "Not enough time has elapsed, please wait " + (node.specification.minWait - timeDelta).toFixed(0) + " seconds");
1172 return; 1171 return;
1173 } 1172 }
1174 node.elapsedTime = timeDelta; 1173 node.elapsedTime = timeDelta;
1200 this.hidePopup(); 1199 this.hidePopup();
1201 this.popupOptions.forEach(function (node) { 1200 this.popupOptions.forEach(function (node) {
1202 this.store.postResult(node); 1201 this.store.postResult(node);
1203 }, this); 1202 }, this);
1204 this.store.complete(); 1203 this.store.complete();
1205 testState.stateIndex++;
1206 advanceState(); 1204 advanceState();
1207 } 1205 }
1208 }; 1206 };
1209 1207
1210 this.previousClick = function () { 1208 this.previousClick = function () {
1368 } 1366 }
1369 if (this.stateIndex > -2) { 1367 if (this.stateIndex > -2) {
1370 storage.update(); 1368 storage.update();
1371 } 1369 }
1372 if (this.stateIndex == -2) { 1370 if (this.stateIndex == -2) {
1371 this.stateIndex++;
1373 if (this.preTestSurvey !== undefined) { 1372 if (this.preTestSurvey !== undefined) {
1374 popup.initState(this.preTestSurvey, storage.globalPreTest); 1373 popup.initState(this.preTestSurvey, storage.globalPreTest);
1375 } else { 1374 } else {
1376 this.stateIndex++;
1377 this.advanceState(); 1375 this.advanceState();
1378 } 1376 }
1379 } else if (this.stateIndex == -1) { 1377 } else if (this.stateIndex == -1) {
1380 if (interfaceContext.calibrationTests.checkFrequencies) { 1378 if (interfaceContext.calibrationTests.checkFrequencies) {
1381 popup.showPopup(); 1379 popup.showPopup();