fix: avoid worker-threads restart at error during startup
[e-mobility-charging-stations-simulator.git] / src / charging-station / Helpers.ts
index 7069038b507e436fda96cb87104af3e331deb68f..bb3bb5af51d540396337e41ef3194cf703d4932d 100644 (file)
@@ -452,12 +452,9 @@ export const stationTemplateToStationInfo = (
 export const createSerialNumber = (
   stationTemplate: ChargingStationTemplate,
   stationInfo: ChargingStationInfo,
-  params: {
+  params?: {
     randomSerialNumberUpperCase?: boolean;
     randomSerialNumber?: boolean;
-  } = {
-    randomSerialNumberUpperCase: true,
-    randomSerialNumber: true,
   },
 ): void => {
   params = { ...{ randomSerialNumberUpperCase: true, randomSerialNumber: true }, ...params };
@@ -967,7 +964,10 @@ const canProceedRecurringChargingProfile = (
     );
     return false;
   }
-  if (isNullOrUndefined(chargingProfile.chargingSchedule.startSchedule)) {
+  if (
+    chargingProfile.chargingProfileKind === ChargingProfileKindType.RECURRING &&
+    isNullOrUndefined(chargingProfile.chargingSchedule.startSchedule)
+  ) {
     logger.error(
       `${logPrefix} ${moduleName}.canProceedRecurringChargingProfile: Recurring charging profile id ${chargingProfile.chargingProfileId} has no startSchedule defined`,
     );