summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
522e4b0)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
addSeconds,
addWeeks,
differenceInDays,
addSeconds,
addWeeks,
differenceInDays,
differenceInWeeks,
isAfter,
isBefore,
differenceInWeeks,
isAfter,
isBefore,
start: chargingSchedule.startSchedule!,
end: addDays(chargingSchedule.startSchedule!, 1),
};
start: chargingSchedule.startSchedule!,
end: addDays(chargingSchedule.startSchedule!, 1),
};
+ checkRecurringChargingProfileDuration(chargingProfile, recurringInterval, logPrefix);
if (
!isWithinInterval(currentDate, recurringInterval) &&
isBefore(chargingSchedule.startSchedule!, currentDate)
if (
!isWithinInterval(currentDate, recurringInterval) &&
isBefore(chargingSchedule.startSchedule!, currentDate)
start: chargingSchedule.startSchedule!,
end: addWeeks(chargingSchedule.startSchedule!, 1),
};
start: chargingSchedule.startSchedule!,
end: addWeeks(chargingSchedule.startSchedule!, 1),
};
+ checkRecurringChargingProfileDuration(chargingProfile, recurringInterval, logPrefix);
if (
!isWithinInterval(currentDate, recurringInterval) &&
isBefore(chargingSchedule.startSchedule!, currentDate)
if (
!isWithinInterval(currentDate, recurringInterval) &&
isBefore(chargingSchedule.startSchedule!, currentDate)
+const checkRecurringChargingProfileDuration = (
+ chargingProfile: ChargingProfile,
+ interval: Interval,
+ logPrefix: string,
+) => {
+ if (
+ chargingProfile.chargingSchedule.duration! > differenceInSeconds(interval.end, interval.start)
+ ) {
+ logger.warn(
+ `${logPrefix} ${moduleName}.getLimitFromChargingProfiles: Recurring ${
+ chargingProfile.chargingProfileKind
+ } charging profile id ${chargingProfile.chargingProfileId} duration ${
+ chargingProfile.chargingSchedule.duration
+ } is greater than the recurrency time interval ${differenceInSeconds(
+ interval.end,
+ interval.start,
+ )} duration`,
+ );
+ }
+};
+
const getRandomSerialNumberSuffix = (params?: {
randomBytesLength?: number;
upperCase?: boolean;
const getRandomSerialNumberSuffix = (params?: {
randomBytesLength?: number;
upperCase?: boolean;