ComputeDurationFromCost():

brutto-time must be updated in case of an carry-over-section.
This commit is contained in:
Gerhard Hoffmann 2024-10-02 15:21:21 +02:00
parent 5a77958e8d
commit 5a55ad6ef0

View File

@ -554,22 +554,22 @@ Calculator::ComputeDurationFromCost(Configuration *cfg,
.arg(netto_parking_time_in_minutes) .arg(netto_parking_time_in_minutes)
.arg(free_parking_time_in_minutes); .arg(free_parking_time_in_minutes);
if (std::optional<ATBTariffCarryOver> co = getCarryOver(cfg, inputDate.addSecs(brutto_parking_time_in_minutes * 60))) { if (std::optional<ATBTariffCarryOver> co = getCarryOver(cfg, dt)) {
TimeRange const &carryOverTimeRange = co.value().m_range; TimeRange const &carryOverTimeRange = co.value().m_range;
free_parking_time_in_minutes += carryOverTimeRange.m_duration; 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<ATBTariffService> serv = getService(cfg, dt)) { if (std::optional<ATBTariffService> serv = getService(cfg, dt)) {
TimeRange const &serviceTimeRange = serv.value().m_range; TimeRange const &serviceTimeRange = serv.value().m_range;