From: Jérôme Benoit Date: Mon, 24 Jul 2023 11:18:41 +0000 (+0200) Subject: refactor: cleanup getLimitFromChargingProfiles() helper return type X-Git-Tag: v1.2.20~159^2~8 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=2ed9c7a844dd0ff83236dab693c18d2fad046310;p=e-mobility-charging-stations-simulator.git refactor: cleanup getLimitFromChargingProfiles() helper return type Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStationUtils.ts b/src/charging-station/ChargingStationUtils.ts index 7865eb1f..749b876b 100644 --- a/src/charging-station/ChargingStationUtils.ts +++ b/src/charging-station/ChargingStationUtils.ts @@ -657,10 +657,12 @@ const convertDeprecatedTemplateKey = ( const getLimitFromChargingProfiles = ( chargingProfiles: ChargingProfile[], logPrefix: string, -): { - limit: number; - matchingChargingProfile: ChargingProfile; -} | null => { +): + | { + limit: number; + matchingChargingProfile: ChargingProfile; + } + | undefined => { const debugLogMsg = `${logPrefix} ${moduleName}.getLimitFromChargingProfiles: Matching charging profile found for power limitation: %j`; const currentDate = new Date(); for (const chargingProfile of chargingProfiles) { @@ -677,7 +679,6 @@ const getLimitFromChargingProfiles = ( ); chargingSchedule.startSchedule = convertToDate(chargingSchedule.startSchedule)!; } - // Check type (recurring) and if it is already active // Adjust the daily recurring schedule to today if ( chargingProfile.chargingProfileKind === ChargingProfileKindType.RECURRING && @@ -746,7 +747,6 @@ const getLimitFromChargingProfiles = ( } } } - return null; }; const getRandomSerialNumberSuffix = (params?: {