ComputeDurationFromCost():
Fix: take into account that there may be more than just two carry-over-ranges. For instance, in Korneuburg (714), there are three as they have a break from 12:00-14:00.
This commit is contained in:
parent
5e673788b4
commit
4b9a4319b3
@ -605,20 +605,41 @@ Calculator::ComputeDurationFromCost(Configuration *cfg,
|
||||
// qCritical() << __func__ << ":" << __LINE__ << "cnt" << cnt << "]";
|
||||
}
|
||||
|
||||
if (cnt >= 1000) {
|
||||
if (cnt >= 10) {
|
||||
qCritical() << __func__ << ":" << __LINE__ << "BREAK";
|
||||
}
|
||||
|
||||
// configure if last carry-over ranges shall be added to ticket-end-time
|
||||
dt = inputDate.addSecs(brutto_parking_time_in_minutes * 60);
|
||||
|
||||
cnt = 0;
|
||||
while (std::optional<ATBTariffCarryOver> co = getCarryOver(cfg, inputDate.addSecs(brutto_parking_time_in_minutes * 60))) {
|
||||
if (++cnt > 5) {
|
||||
qCritical() << __func__ << ":" << __LINE__ << "BREAK";
|
||||
QVector<TimeRange> timeRanges;
|
||||
while (std::optional<ATBTariffCarryOver> co = getCarryOver(cfg, dt)) {
|
||||
if (++cnt > 10) {
|
||||
break;
|
||||
}
|
||||
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;
|
||||
if (!timeRanges.isEmpty()) {
|
||||
if (timeRanges.last().m_end != carryOverTimeRange.m_start) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
timeRanges.push_back(carryOverTimeRange);
|
||||
|
||||
int minutes = co.value().computeMinutesUntilCarryOverEnd(dt);
|
||||
if (minutes > 0) {
|
||||
free_parking_time_in_minutes += co.value().computeMinutesUntilCarryOverEnd(dt);
|
||||
brutto_parking_time_in_minutes = free_parking_time_in_minutes + netto_parking_time_in_minutes;
|
||||
|
||||
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);
|
||||
|
||||
dt = inputDate.addSecs(brutto_parking_time_in_minutes * 60);
|
||||
} else break;
|
||||
}
|
||||
|
||||
brutto_parking_time_in_minutes = free_parking_time_in_minutes + netto_parking_time_in_minutes;
|
||||
|
Loading…
Reference in New Issue
Block a user