Mercurial > hg > webaudioevaluationtool
comparison js/core.js @ 2717:723e1e5bae6f
JSHint merges
author | Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk> |
---|---|
date | Fri, 14 Apr 2017 16:12:52 +0100 |
parents | 57ba3f490836 |
children | 65c19c3f45c4 |
comparison
equal
deleted
inserted
replaced
2716:57ba3f490836 | 2717:723e1e5bae6f |
---|---|
1237 this.currentStore = null; | 1237 this.currentStore = null; |
1238 this.initialise = function () { | 1238 this.initialise = function () { |
1239 | 1239 |
1240 // Get the data from Specification | 1240 // Get the data from Specification |
1241 var pagePool = []; | 1241 var pagePool = []; |
1242 for (var page of specification.pages) { | 1242 specification.pages.forEach(function(page){ |
1243 if (page.position !== null || page.alwaysInclude) { | 1243 if (page.position !== null || page.alwaysInclude) { |
1244 page.alwaysInclude = true; | 1244 page.alwaysInclude = true; |
1245 } | 1245 } |
1246 pagePool.push(page); | 1246 pagePool.push(page); |
1247 } | 1247 }); |
1248 if (specification.numPages > 0) { | 1248 if (specification.numPages > 0) { |
1249 specification.randomiseOrder = true; | 1249 specification.randomiseOrder = true; |
1250 pagePool = pickSubPool(pagePool, specification.numPages); | 1250 pagePool = pickSubPool(pagePool, specification.numPages); |
1251 } | 1251 } |
1252 | 1252 |
1253 // Now get the order of pages | 1253 // Now get the order of pages |
1254 var fixed = []; | 1254 var fixed = []; |
1255 for (var page of pagePool) { | 1255 pagePool.forEach(function(page){ |
1256 if (page.position !== null) { | 1256 if (page.position !== null) { |
1257 fixed.push(page); | 1257 fixed.push(page); |
1258 var i = pagePool.indexOf(page); | 1258 var i = pagePool.indexOf(page); |
1259 pagePool.splice(i, 1); | 1259 pagePool.splice(i, 1); |
1260 } | 1260 } |
1261 } | 1261 }); |
1262 | 1262 |
1263 if (specification.randomiseOrder) { | 1263 if (specification.randomiseOrder) { |
1264 pagePool = randomiseOrder(pagePool); | 1264 pagePool = randomiseOrder(pagePool); |
1265 } | 1265 } |
1266 | 1266 |
1267 // Place in the correct order | 1267 // Place in the correct order |
1268 for (var page of fixed) { | 1268 fixed.forEach(function(page) { |
1269 pagePool.splice(page.position, 0, page); | 1269 pagePool.splice(page.position, 0, page); |
1270 } | 1270 }); |
1271 | 1271 |
1272 // Now process the pages | 1272 // Now process the pages |
1273 pagePool.forEach(function (page, i) { | 1273 pagePool.forEach(function (page, i) { |
1274 page.presentedId = i; | 1274 page.presentedId = i; |
1275 this.stateMap.push(page); | 1275 this.stateMap.push(page); |