From bdc9dc79f18b4af66cf9565e8df86d0348fd294c Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 19 Jul 2023 18:19:28 +0200 Subject: [PATCH] fix: fix ATG startup MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- package.json | 2 +- src/charging-station/AutomaticTransactionGenerator.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 736ab6dd..bed0de60 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "preinstall": "node skip-preinstall.cjs || npx --yes only-allow pnpm", "prepare": "node prepare.cjs", "build-requirements": "node --no-warnings build-requirements.mjs", - "start": "pnpm build && cross-env NODE_ENV=production node -r source-map-support/register dist/start.js", + "start": "pnpm build && cross-env NODE_ENV=production node dist/start.js", "start:dev": "pnpm build:dev && cross-env NODE_ENV=development node -r source-map-support/register dist/start.js", "start:dev:debug": "pnpm build:dev && cross-env NODE_ENV=development node -r source-map-support/register --inspect dist/start.js", "start:prof": "cross-env NODE_ENV=production node -r source-map-support/register --prof dist/start.js", diff --git a/src/charging-station/AutomaticTransactionGenerator.ts b/src/charging-station/AutomaticTransactionGenerator.ts index 3e7f0716..578f47e9 100644 --- a/src/charging-station/AutomaticTransactionGenerator.ts +++ b/src/charging-station/AutomaticTransactionGenerator.ts @@ -347,9 +347,9 @@ export class AutomaticTransactionGenerator extends AsyncResource { } private getConnectorStatus(connectorId: number): Status { - const connectorStatus = cloneObject( - this.chargingStation.getAutomaticTransactionGeneratorStatuses()!, - )[connectorId]; + const connectorStatus = this.chargingStation.getAutomaticTransactionGeneratorStatuses() + ? cloneObject(this.chargingStation.getAutomaticTransactionGeneratorStatuses()!)[connectorId] + : undefined; delete connectorStatus?.startDate; delete connectorStatus?.lastRunDate; delete connectorStatus?.stopDate; -- 2.34.1