From: Jérôme Benoit Date: Wed, 19 Jul 2023 16:19:28 +0000 (+0200) Subject: fix: fix ATG startup X-Git-Tag: v1.2.19~3 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=bdc9dc79f18b4af66cf9565e8df86d0348fd294c;p=e-mobility-charging-stations-simulator.git fix: fix ATG startup Signed-off-by: Jérôme Benoit --- 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;