- if (!isArraySorted(chargingProfiles, (a, b) => b.stackLevel - a.stackLevel)) {
- logger.warn(
- `${logPrefix} ${moduleName}.getLimitFromChargingProfiles: Charging profiles are not sorted by stack level. Trying to sort them`,
- );
- chargingProfiles.sort((a, b) => b.stackLevel - a.stackLevel);
- }