Moved check if netto minutes exceed max. parking time down into loop.
If this is the case, then stop updating the end-time-date.
This commit is contained in:
parent
38eca50d83
commit
9d713c894d
@ -707,10 +707,16 @@ Ticket Calculator::private_GetDurationFromCost(Configuration *cfg,
|
||||
if (!IsYearPeriodActive(cfg, current)) {
|
||||
return Ticket();
|
||||
}
|
||||
if(durationMinutesNetto > maxParkingTimeMinutes) {
|
||||
durationMinutesNetto = maxParkingTimeMinutes;
|
||||
break;
|
||||
}
|
||||
// if(durationMinutesNetto >= maxParkingTimeMinutes) {
|
||||
// might be useful for overpayment
|
||||
// durationMinutesNetto = maxParkingTimeMinutes;
|
||||
// int durationMinutesBrutto = start.secsTo(end) / 60;
|
||||
//
|
||||
// return
|
||||
// Ticket(start, end, durationMinutesNetto,
|
||||
// durationMinutesBrutto, cost, Ticket::s[INVALID_PRICE]);
|
||||
//
|
||||
// }
|
||||
if(current.time() >= lastWorktimeTo) {
|
||||
// Go to next day if minutes not spent
|
||||
if (carryOverNotSet) {
|
||||
@ -722,11 +728,20 @@ Ticket Calculator::private_GetDurationFromCost(Configuration *cfg,
|
||||
} else {
|
||||
if(current.time() < worktime_to) {
|
||||
// Increment input date minutes for each monetary unit
|
||||
durationMinutesNetto +=1;
|
||||
durationMinutesNetto += 1;
|
||||
moneyLeft -= price;
|
||||
moneyLeft = std::round(moneyLeft * 1000.0) / 1000.0;
|
||||
current = current.addSecs(60);
|
||||
end = current;
|
||||
|
||||
//qCritical() << "moneyLeft" << moneyLeft
|
||||
// << "durationMinutesNetto" << durationMinutesNetto
|
||||
// << "current" << current.toString(Qt::ISODate);
|
||||
|
||||
if(durationMinutesNetto <= maxParkingTimeMinutes) {
|
||||
// stop updating of end-date if parking time is
|
||||
// overshot
|
||||
end = current;
|
||||
}
|
||||
} else break;
|
||||
}
|
||||
} // while(durationMinutes > 0) {
|
||||
@ -734,7 +749,7 @@ Ticket Calculator::private_GetDurationFromCost(Configuration *cfg,
|
||||
} // for (int w = currentRange; w < ranges; ++w, ++totalTimeRanges) {
|
||||
} // for (current = start; durationMinutes > 0; current = current.addDays(1)) {
|
||||
|
||||
int durationMinutesBrutto = start.secsTo(end) / 60;
|
||||
int durationMinutesBrutto = start.secsTo(end) / 60;
|
||||
|
||||
//qCritical() << "start" << start.toString(Qt::ISODate) << "end"
|
||||
// << end.toString(Qt::ISODate) << durationMinutesBrutto;
|
||||
|
Loading…
Reference in New Issue
Block a user