From: Jérôme Benoit Date: Sat, 30 Dec 2023 12:39:47 +0000 (+0100) Subject: fix: fix get composite schedule rejection condition X-Git-Tag: v1.2.31~9 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=a4385edc2344433c20fcb92d01cbe5a330b850b4;p=e-mobility-charging-stations-simulator.git fix: fix get composite schedule rejection condition Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ocpp/1.6/OCPP16Constants.ts b/src/charging-station/ocpp/1.6/OCPP16Constants.ts index b4a98ed0..17a8c033 100644 --- a/src/charging-station/ocpp/1.6/OCPP16Constants.ts +++ b/src/charging-station/ocpp/1.6/OCPP16Constants.ts @@ -110,6 +110,6 @@ export class OCPP16Constants extends OCPPConstants { { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Finishing }, { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Reserved }, { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Unavailable } - // { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Faulted }, + // { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Faulted } ]) } diff --git a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts index 2f2ef4c1..54741e67 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -700,10 +700,8 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const connectorStatus = chargingStation.getConnectorStatus(connectorId)! if ( - isEmptyArray( - connectorStatus?.chargingProfiles != null && - isEmptyArray(chargingStation.getConnectorStatus(0)?.chargingProfiles) - ) + isEmptyArray(connectorStatus?.chargingProfiles) && + isEmptyArray(chargingStation.getConnectorStatus(0)?.chargingProfiles) ) { return OCPP16Constants.OCPP_RESPONSE_REJECTED } diff --git a/src/charging-station/ocpp/2.0/OCPP20Constants.ts b/src/charging-station/ocpp/2.0/OCPP20Constants.ts index 266bac11..ea50ba0a 100644 --- a/src/charging-station/ocpp/2.0/OCPP20Constants.ts +++ b/src/charging-station/ocpp/2.0/OCPP20Constants.ts @@ -88,7 +88,7 @@ export class OCPP20Constants extends OCPPConstants { from: OCPP20ConnectorStatusEnumType.Faulted, to: OCPP20ConnectorStatusEnumType.Unavailable } - // { from: OCPP20ConnectorStatusEnumType.Faulted, to: OCPP20ConnectorStatusEnumType.Faulted }, + // { from: OCPP20ConnectorStatusEnumType.Faulted, to: OCPP20ConnectorStatusEnumType.Faulted } ] ) } diff --git a/src/types/orm/entities/PerformanceData.ts b/src/types/orm/entities/PerformanceData.ts index 7774a96c..28f2b346 100644 --- a/src/types/orm/entities/PerformanceData.ts +++ b/src/types/orm/entities/PerformanceData.ts @@ -2,40 +2,40 @@ import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core' // eslint-disable-next-line @typescript-eslint/no-unused-vars -import type { PerformanceRecord } from './PerformanceRecord.js' +import { PerformanceRecord } from './PerformanceRecord.js' @Entity() export class PerformanceData { // @PrimaryKey() - // pk!: number; + // pk!: number // @Property() - // commandName!: string; + // commandName!: string // @Property() - // countRequest!: number; + // countRequest!: number // @Property() - // countResponse!: number; + // countResponse!: number // @Property() - // countError!: number; + // countError!: number // @Property() - // countTimeMeasurement!: number; + // countTimeMeasurement!: number // @Property() - // timeMeasurementSeries!: number[]; + // timeMeasurementSeries!: number[] // @Property() - // currentTimeMeasurement!: number; + // currentTimeMeasurement!: number // @Property() - // minTimeMeasurement!: number; + // minTimeMeasurement!: number // @Property() - // maxTimeMeasurement!: number; + // maxTimeMeasurement!: number // @Property() - // totalTimeMeasurement!: number; + // totalTimeMeasurement!: number // @Property() - // avgTimeMeasurement!: number; + // avgTimeMeasurement!: number // @Property() - // medTimeMeasurement!: number; + // medTimeMeasurement!: number // @Property() - // ninetyFiveThPercentileTimeMeasurement!: number; + // ninetyFiveThPercentileTimeMeasurement!: number // @Property() - // stdDevTimeMeasurement!: number; + // stdDevTimeMeasurement!: number // @ManyToOne('PerformanceRecord') - // performanceRecord!: PerformanceRecord; + // performanceRecord!: PerformanceRecord } diff --git a/src/types/orm/entities/PerformanceRecord.ts b/src/types/orm/entities/PerformanceRecord.ts index c752e099..36db5c5b 100644 --- a/src/types/orm/entities/PerformanceRecord.ts +++ b/src/types/orm/entities/PerformanceRecord.ts @@ -7,15 +7,15 @@ import type { PerformanceData } from './PerformanceData.js' @Entity() export class PerformanceRecord { // @PrimaryKey() - // pk!: number; + // pk!: number // @Property() - // id!: string; + // id!: string // @Property() - // URI!: string; + // URI!: string // @Property() - // createdAt!: Date; + // createdAt!: Date // @Property() - // updatedAt?: Date; + // updatedAt?: Date // @OneToMany('PerformanceData', 'performanceRecord') - // performanceData? = new Collection(this); + // performanceData? = new Collection(this) } diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index 42af7c52..87ea9a2c 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -85,10 +85,8 @@ export const convertToDate = ( return value } if (isString(value) || typeof value === 'number') { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const valueToDate = new Date(value) if (isNaN(valueToDate.getTime())) { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion throw new Error(`Cannot convert to date: '${value}'`) } return valueToDate diff --git a/src/worker/WorkerSet.ts b/src/worker/WorkerSet.ts index 41214c8d..b8e0e31f 100644 --- a/src/worker/WorkerSet.ts +++ b/src/worker/WorkerSet.ts @@ -40,7 +40,7 @@ export class WorkerSet extends WorkerAbstract { throw new RangeError('Elements per worker must be greater than zero') } this.workerSet = new Set() - if (this.workerOptions.poolOptions?.enableEvents != null) { + if (this.workerOptions.poolOptions?.enableEvents === true) { this.emitter = new EventEmitterAsyncResource({ name: 'workerset' }) } this.started = false