}
public getNumberOfRunningTransactions(): number {
- let trxCount = 0;
+ let numberOfRunningTransactions = 0;
if (this.hasEvses) {
for (const [evseId, evseStatus] of this.evses) {
if (evseId === 0) {
}
for (const connectorStatus of evseStatus.connectors.values()) {
if (connectorStatus.transactionStarted === true) {
- ++trxCount;
+ ++numberOfRunningTransactions;
}
}
}
} else {
for (const connectorId of this.connectors.keys()) {
if (connectorId > 0 && this.getConnectorStatus(connectorId)?.transactionStarted === true) {
- ++trxCount;
+ ++numberOfRunningTransactions;
}
}
}
- return trxCount;
+ return numberOfRunningTransactions;
}
public getOutOfOrderEndMeterValues(): boolean {
}
private getNumberOfReservationsOnConnectorZero(): number {
- let numberOfReservations = 0;
if (
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
(this.hasEvses && this.evses.get(0)?.connectors.get(0)?.reservation) ||
(!this.hasEvses && this.connectors.get(0)?.reservation)
) {
- ++numberOfReservations;
+ return 1;
}
- return numberOfReservations;
+ return 0;
}
private flushMessageBuffer(): void {
export const getNumberOfReservableConnectors = (
connectors: Map<number, ConnectorStatus>,
): number => {
- let reservableConnectors = 0;
+ let numberOfReservableConnectors = 0;
for (const [connectorId, connectorStatus] of connectors) {
if (connectorId === 0) {
continue;
}
if (connectorStatus.status === ConnectorStatusEnum.Available) {
- ++reservableConnectors;
+ ++numberOfReservableConnectors;
}
}
- return reservableConnectors;
+ return numberOfReservableConnectors;
};
export const getHashId = (index: number, stationTemplate: ChargingStationTemplate): string => {
templateMaxConnectors: number;
templateMaxAvailableConnectors: number;
} => {
- const configuredMaxConnectors = getConfiguredNumberOfConnectors(stationTemplate);
+ const configuredMaxConnectors = getConfiguredMaxNumberOfConnectors(stationTemplate);
checkConfiguredMaxConnectors(configuredMaxConnectors, logPrefix, templateFile);
const templateMaxConnectors = getMaxNumberOfConnectors(stationTemplate.Connectors!);
checkTemplateMaxConnectors(templateMaxConnectors, logPrefix, templateFile);
});
};
-const getConfiguredNumberOfConnectors = (stationTemplate: ChargingStationTemplate): number => {
- let configuredMaxConnectors = 0;
+const getConfiguredMaxNumberOfConnectors = (stationTemplate: ChargingStationTemplate): number => {
+ let configuredMaxNumberOfConnectors = 0;
if (isNotEmptyArray(stationTemplate.numberOfConnectors) === true) {
const numberOfConnectors = stationTemplate.numberOfConnectors as number[];
- configuredMaxConnectors =
+ configuredMaxNumberOfConnectors =
numberOfConnectors[Math.floor(secureRandom() * numberOfConnectors.length)];
} else if (isUndefined(stationTemplate.numberOfConnectors) === false) {
- configuredMaxConnectors = stationTemplate.numberOfConnectors as number;
+ configuredMaxNumberOfConnectors = stationTemplate.numberOfConnectors as number;
} else if (stationTemplate.Connectors && !stationTemplate.Evses) {
- configuredMaxConnectors = stationTemplate.Connectors[0]
+ configuredMaxNumberOfConnectors = stationTemplate.Connectors[0]
? getMaxNumberOfConnectors(stationTemplate.Connectors) - 1
: getMaxNumberOfConnectors(stationTemplate.Connectors);
} else if (stationTemplate.Evses && !stationTemplate.Connectors) {
if (evse === '0') {
continue;
}
- configuredMaxConnectors += getMaxNumberOfConnectors(stationTemplate.Evses[evse].Connectors);
+ configuredMaxNumberOfConnectors += getMaxNumberOfConnectors(
+ stationTemplate.Evses[evse].Connectors,
+ );
}
}
- return configuredMaxConnectors;
+ return configuredMaxNumberOfConnectors;
};
const checkConfiguredMaxConnectors = (