From 648799629a80346b9502d1031dd0542963a7c44f Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Mon, 19 Aug 2024 12:19:01 +0200 Subject: [PATCH] GetTimeSteps(): Fix: check not only if "current" is above carryOverStart, but also if "current" is below carryOverEnd. --- library/src/calculator_functions.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/src/calculator_functions.cpp b/library/src/calculator_functions.cpp index e8518e5..e01a68c 100644 --- a/library/src/calculator_functions.cpp +++ b/library/src/calculator_functions.cpp @@ -2893,12 +2893,13 @@ QList &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex, int const durationInSecs = it->second.pun_duration_saved * 60; it->second.pun_duration = it->second.pun_duration_saved; - if (current >= carryOverStart) { + + if (current >= carryOverStart && current < carryOverEnd) { it->second.pun_duration += current.secsTo(carryOverEnd) / 60; } else { // start < carryOverStart QDateTime const &newCurrent = current.addSecs(durationInSecs); - if (newCurrent > carryOverStart) { + if (newCurrent > carryOverStart && newCurrent <= carryOverEnd) { // cross carry over section it->second.pun_next_step_correction = carryOverStart.secsTo(carryOverEnd) / 60; it->second.pun_duration += it->second.pun_next_step_correction;