diff --git a/.vs/AAWebPlatform/v15/.suo b/.vs/AAWebPlatform/v15/.suo index cf7d5572c..0eea32e5d 100644 Binary files a/.vs/AAWebPlatform/v15/.suo and b/.vs/AAWebPlatform/v15/.suo differ diff --git a/CompetitionStorage.js b/CompetitionStorage.js index 280727ecc..73009b838 100644 --- a/CompetitionStorage.js +++ b/CompetitionStorage.js @@ -55,7 +55,7 @@ function newCompetitionStorage(pName) { let file = newFile(); file.initialize(devTeam, bot, product, thisSet, undefined, undefined, onSingleFileReady); - thisObject.files.set(devTeam.codeName+ "-" + bot.codeName, file); + thisObject.files.set(pCompetition.participants[i].devTeam + "-" + pCompetition.participants[i].bot, file); dataSetsToLoad++; if (CONSOLE_LOG === true) { diff --git a/Ecosystem.js b/Ecosystem.js index 9da330e92..e9cf5aef1 100644 --- a/Ecosystem.js +++ b/Ecosystem.js @@ -2,6 +2,8 @@ function newEcosystem() { let ecosystem = { + getHost: getHost, + getCompetition: getCompetition, getTeam: getTeam, getTeams: getTeams, getBot: getBot, diff --git a/File.js b/File.js index 73068a2f3..878726be2 100644 --- a/File.js +++ b/File.js @@ -15,7 +15,7 @@ function newFile() { let exchange = ecosystem.getExchange(pProduct, pExchange); - if (exchange === undefined) { + if (pExchange !== undefined && exchange === undefined) { // We support no exchange as a parameter, but if provided, then it must be at the list of exchanges of that product. throw "Exchange not supoorted by this pProduct of the ecosystem! - pDevTeam.codeName = " + pDevTeam.codeName + ", pBot.codeName = " + pBot.codeName + ", pProduct.codeName = " + pProduct.codeName + ", pExchange = " + pExchange; diff --git a/FileCloud.js b/FileCloud.js index 030e63e72..b788f3caa 100644 --- a/FileCloud.js +++ b/FileCloud.js @@ -36,12 +36,27 @@ function newFileCloud() { throw ("Inconsistant data received."); } - fileName = fileName.replace("@AssetA", pMarket.assetA); - fileName = fileName.replace("@AssetB", pMarket.assetB); + if (pMarket !== undefined) { + + fileName = fileName.replace("@AssetA", pMarket.assetA); + fileName = fileName.replace("@AssetB", pMarket.assetB); + } + + if (pDevTeam !== undefined) { + + filePath = filePath.replace("@DevTeam", pDevTeam.codeName); + } + + if (pBot !== undefined) { + + filePath = filePath.replace("@Bot", pBot.codeName); + } + + if (pExchange !== undefined) { + + filePath = filePath.replace("@Exchange", pExchange.name); + } - filePath = filePath.replace("@DevTeam", pDevTeam.codeName); - filePath = filePath.replace("@Bot", pBot.codeName); - filePath = filePath.replace("@Exchange", pExchange.name); filePath = filePath.replace("@Period", pPeriodName); if (pDatetime !== undefined) { diff --git a/TimelineChart.js b/TimelineChart.js index fb5a305d1..20356eb92 100644 --- a/TimelineChart.js +++ b/TimelineChart.js @@ -3,7 +3,8 @@ function newTimelineChart() { const CONSOLE_LOG = false; - let activePlotters = []; + let productPlotters = []; + let competitionPlotters = []; let timeLineCoordinateSystem = newTimeLineCoordinateSystem(); @@ -121,7 +122,7 @@ function newTimelineChart() { plotter.container.frame.position.x = thisObject.container.frame.width / 2 - plotter.container.frame.width / 2; plotter.container.frame.position.y = thisObject.container.frame.height / 2 - plotter.container.frame.height / 2; - plotter.initialize(storage, datetime, timePeriod, onPlotterInizialized); + plotter.initialize(competition, storage, datetime, timePeriod, onPlotterInizialized); function onPlotterInizialized() { @@ -131,15 +132,14 @@ function newTimelineChart() { } - let activePlotter = { - productCard: undefined, + let competitionPlotter = { plotter: plotter, storage: storage }; /* Add the new Active Protter to the Array */ - activePlotters.push(activePlotter); + competitionPlotters.push(competitionPlotter); } } @@ -238,7 +238,7 @@ function newTimelineChart() { // If the plotter does not implement this function its ok. } - let activePlotter = { + let productPlotter = { productCard: pProductCard, plotter: plotter, storage: storage @@ -250,7 +250,7 @@ function newTimelineChart() { /* Add the new Active Protter to the Array */ - activePlotters.push(activePlotter); + productPlotters.push(productPlotter); } } @@ -264,9 +264,9 @@ function newTimelineChart() { let found = false; - for (let i = 0; i < activePlotters.length; i++) { + for (let i = 0; i < productPlotters.length; i++) { - if (activePlotters[i].productCard.code === pProductCard.code) { + if (productPlotters[i].productCard.code === pProductCard.code) { found = true; @@ -286,11 +286,11 @@ function newTimelineChart() { /* If the plotter of this card is on our Active Plotters list, then we remove it. */ - for (let i = 0; i < activePlotters.length; i++) { + for (let i = 0; i < productPlotters.length; i++) { - if (activePlotters[i].productCard.code === pProductCard.code) { + if (productPlotters[i].productCard.code === pProductCard.code) { - activePlotters.splice(i, 1); // Delete item from array. + productPlotters.splice(i, 1); // Delete item from array. } } @@ -311,15 +311,23 @@ function newTimelineChart() { if (timePeriod !== currentTimePeriod) { - for (let i = 0; i < activePlotters.length; i++) { + for (let i = 0; i < productPlotters.length; i++) { - let activePlotter = activePlotters[i]; + let productPlotter = productPlotters[i]; - activePlotter.productCard.setTimePeriod(timePeriod); - activePlotter.storage.setTimePeriod(timePeriod); - activePlotter.plotter.setTimePeriod(timePeriod); + productPlotter.productCard.setTimePeriod(timePeriod); + productPlotter.storage.setTimePeriod(timePeriod); + productPlotter.plotter.setTimePeriod(timePeriod); } + + for (let i = 0; i < competitionPlotters.length; i++) { + + let competitionPlotter = competitionPlotters[i]; + + competitionPlotter.plotter.setTimePeriod(timePeriod); + + } } recalculateCurrentDatetime(); @@ -374,16 +382,24 @@ function newTimelineChart() { datetime = newDate; - for (var i = 0; i < activePlotters.length; i++) { + for (var i = 0; i < productPlotters.length; i++) { - let activePlotter = activePlotters[i]; + let productPlotter = productPlotters[i]; - activePlotter.productCard.setDatetime(datetime); - activePlotter.storage.setDatetime(datetime); - activePlotter.plotter.setDatetime(datetime); + productPlotter.productCard.setDatetime(datetime); + productPlotter.storage.setDatetime(datetime); + productPlotter.plotter.setDatetime(datetime); } + for (let i = 0; i < competitionPlotters.length; i++) { + + let competitionPlotter = competitionPlotters[i]; + + competitionPlotter.plotter.setDatetime(datetime); + + } + thisObject.container.eventHandler.raiseEvent("Datetime Changed", datetime); } @@ -414,27 +430,35 @@ function newTimelineChart() { if (thisObject.container.frame.isInViewPort()) { - for (var i = 0; i < activePlotters.length; i++) { + for (var i = 0; i < productPlotters.length; i++) { - let activePlotter = activePlotters[i]; + let productPlotter = productPlotters[i]; - activePlotter.productCard.setDatetime(pDatetime); - activePlotter.storage.setDatetime(pDatetime); - activePlotter.plotter.setDatetime(pDatetime); + productPlotter.productCard.setDatetime(pDatetime); + productPlotter.storage.setDatetime(pDatetime); + productPlotter.plotter.setDatetime(pDatetime); /* The time has changed, but the viewPort is still on the same place, so we request any of the plotters to reposition it. */ - if (activePlotter.plotter.positionAtDatetime !== undefined) { - activePlotter.plotter.positionAtDatetime(pDatetime); + if (productPlotter.plotter.positionAtDatetime !== undefined) { + productPlotter.plotter.positionAtDatetime(pDatetime); } } + + for (let i = 0; i < competitionPlotters.length; i++) { + + let competitionPlotter = competitionPlotters[i]; + + competitionPlotter.plotter.setDatetime(datetime); + + } } } function draw() { - if (activePlotters === undefined) { return; } // We need to wait + if (productPlotters === undefined) { return; } // We need to wait if (thisObject.container.frame.isInViewPort()) { @@ -444,10 +468,18 @@ function newTimelineChart() { chartGrid.draw(thisObject.container, timeLineCoordinateSystem); - for (var i = 0; i < activePlotters.length; i++) { + for (var i = 0; i < productPlotters.length; i++) { - let activePlotter = activePlotters[i]; - activePlotter.plotter.draw(); + let productPlotter = productPlotters[i]; + productPlotter.plotter.draw(); + + } + + for (let i = 0; i < competitionPlotters.length; i++) { + + let competitionPlotter = competitionPlotters[i]; + + competitionPlotter.plotter.draw(); } } diff --git a/server.js b/server.js index 9c1dcd4e9..1c66dcc86 100644 --- a/server.js +++ b/server.js @@ -6,7 +6,7 @@ if (CONSOLE_LOG === true) { } -const DEBUG_MODE = true; // This forces the server to read Plotters from the local drive. +const DEBUG_MODE = false; // This forces the server to read Plotters from the local drive. if (CONSOLE_LOG === true && DEBUG_MODE === true) { @@ -143,7 +143,13 @@ function initialize() { pData = pData.trim(); // remove first byte with some encoding. let configObj = JSON.parse(pData); - competition.configObj = configObj; + + /* Since we are going to replace the full bot object and we dont want to lose these two properties, we do this: */ + + configObj.repo = competition.repo; + configObj.configFile = competition.configFile; + + host.competitions[j] = configObj; if (requestsSent === responsesReceived) { @@ -181,7 +187,13 @@ function initialize() { pData = pData.trim(); // remove first byte with some encoding. let configObj = JSON.parse(pData); - competition.configObj = configObj; + + /* Since we are going to replace the full bot object and we dont want to lose these two properties, we do this: */ + + configObj.repo = competition.repo; + configObj.configFile = competition.configFile; + + host.competitions[j] = configObj; if (requestsSent === responsesReceived) {