From 5a55ad6ef04b99ea7c4f0be8020950d9cbc76826 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Wed, 2 Oct 2024 15:21:21 +0200 Subject: [PATCH] ComputeDurationFromCost(): brutto-time must be updated in case of an carry-over-section. --- library/src/calculator_functions.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/library/src/calculator_functions.cpp b/library/src/calculator_functions.cpp index 1725d9f..1de18f6 100644 --- a/library/src/calculator_functions.cpp +++ b/library/src/calculator_functions.cpp @@ -554,22 +554,22 @@ Calculator::ComputeDurationFromCost(Configuration *cfg, .arg(netto_parking_time_in_minutes) .arg(free_parking_time_in_minutes); - if (std::optional co = getCarryOver(cfg, inputDate.addSecs(brutto_parking_time_in_minutes * 60))) { + if (std::optional co = getCarryOver(cfg, dt)) { TimeRange const &carryOverTimeRange = co.value().m_range; free_parking_time_in_minutes += carryOverTimeRange.m_duration; + + brutto_parking_time_in_minutes = free_parking_time_in_minutes + netto_parking_time_in_minutes; + dt = inputDate.addSecs(brutto_parking_time_in_minutes * 60); + weekDay = dt.date().dayOfWeek(); + + qCritical() << __func__ << ":" << __LINE__ << QString("%1 (%2): brutto: %3 = netto: %4 + free: %5") + .arg(dt.toString(Qt::ISODate)) + .arg(weekDay) + .arg(brutto_parking_time_in_minutes) + .arg(netto_parking_time_in_minutes) + .arg(free_parking_time_in_minutes); } - brutto_parking_time_in_minutes = free_parking_time_in_minutes + netto_parking_time_in_minutes; - dt = inputDate.addSecs(brutto_parking_time_in_minutes * 60); - weekDay = dt.date().dayOfWeek(); - - qCritical() << __func__ << ":" << __LINE__ << QString("%1 (%2): brutto: %3 = netto: %4 + free: %5") - .arg(dt.toString(Qt::ISODate)) - .arg(weekDay) - .arg(brutto_parking_time_in_minutes) - .arg(netto_parking_time_in_minutes) - .arg(free_parking_time_in_minutes); - if (std::optional serv = getService(cfg, dt)) { TimeRange const &serviceTimeRange = serv.value().m_range;