From 484fc13da69eb729994848a518c0c050b434aa7e Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 23 Jun 2018 09:39:24 +0200 Subject: [PATCH] Considering first ever bot execution with no status report --- Context.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Context.js b/Context.js index 76db4c8d5..06dcfdf4c 100644 --- a/Context.js +++ b/Context.js @@ -165,6 +165,23 @@ statusReportModule = statusDependencies.statusReports.get(key); thisObject.statusReport = statusReportModule.file; + /* + The first time ever a bot is run, it will not have a status report previously saved. In that case, we need to create the basic structure of it + in order to work. + */ + + if (thisObject.statusReport.liveRuns === undefined) { + thisObject.statusReport.liveRuns = []; + } + + if (thisObject.statusReport.backtestRuns === undefined) { + thisObject.statusReport.backtestRuns = []; + } + + if (thisObject.statusReport.competitionRuns === undefined) { + thisObject.statusReport.competitionRuns = []; + } + if (bot.hasTheBotJustStarted === true) { createConext(callBack);