GetTimeSteps():

Fix: check not only if "current" is above carryOverStart, but also
	     if "current" is below carryOverEnd.
This commit is contained in:
Gerhard Hoffmann 2024-08-19 12:19:01 +02:00
parent 84e2530767
commit 648799629a

View File

@ -2893,12 +2893,13 @@ QList<int> &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;