fix: fix get composite schedule rejection condition
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 30 Dec 2023 12:39:47 +0000 (13:39 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 30 Dec 2023 12:39:47 +0000 (13:39 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ocpp/1.6/OCPP16Constants.ts
src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts
src/charging-station/ocpp/2.0/OCPP20Constants.ts
src/types/orm/entities/PerformanceData.ts
src/types/orm/entities/PerformanceRecord.ts
src/utils/Utils.ts
src/worker/WorkerSet.ts

index b4a98ed0febc3320216e681a72eb7529104a7a2c..17a8c033a09450e166c019361bacd7fb67401ff5 100644 (file)
@@ -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 }
     ])
 }
index 2f2ef4c10cbaa63dda8bc74c0577efd6c4c086c5..54741e67b8780439e69528af6860a88b9c29a2e8 100644 (file)
@@ -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
     }
index 266bac114649b9ac78449ae052fa89fc6171b3a5..ea50ba0aa685c7c076418d56929f4d4f899c0d18 100644 (file)
@@ -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 }
     ]
   )
 }
index 7774a96c62c56de8074b3154aad0bf5349bbaf89..28f2b34665d1b296d591336d3ed8605faeed6dda 100644 (file)
@@ -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
 }
index c752e0997af013b2613c5cfc855c9e5dcd651292..36db5c5bc1b2f19235afac093074c3db4aabe310 100644 (file)
@@ -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<PerformanceData>(this);
+  //   performanceData? = new Collection<PerformanceData>(this)
 }
index 42af7c528e7ae1251838461a35512c3e73af5ce9..87ea9a2cc1f96c5ad19aab5e6a20760c126f8489 100644 (file)
@@ -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
index 41214c8daa2718162ee4b70d0146bd1f948b9c86..b8e0e31fb641b94080933a87f06779009e95e43a 100644 (file)
@@ -40,7 +40,7 @@ export class WorkerSet extends WorkerAbstract<WorkerData> {
       throw new RangeError('Elements per worker must be greater than zero')
     }
     this.workerSet = new Set<WorkerSetElement>()
-    if (this.workerOptions.poolOptions?.enableEvents != null) {
+    if (this.workerOptions.poolOptions?.enableEvents === true) {
       this.emitter = new EventEmitterAsyncResource({ name: 'workerset' })
     }
     this.started = false