Fix: if start-time is out-of-range (after valid time for sell), switch
to next valid time, taking into account if next valid time is on next day.
This commit is contained in:
parent
de0be1d19b
commit
78cae24389
@ -903,7 +903,20 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
|
||||
<< effectiveStartTime.toString(Qt::ISODate);
|
||||
} else
|
||||
if (start_parking_time.time() > p.prepaid[weekDay].static_start) { // static_start: e.g. 22:00:00
|
||||
effectiveStartTime.setTime(p.prepaid[weekDay].static_start);
|
||||
QTime const midnight(23, 59, 59);
|
||||
QTime const midnight24(0, 0, 0);
|
||||
|
||||
if ((p.prepaid[weekDay].static_start <= midnight && midnight24 <= p.prepaid[weekDay].static_end)
|
||||
|| (p.prepaid[weekDay].static_start == midnight && midnight == p.prepaid[weekDay].static_end)
|
||||
|| (p.prepaid[weekDay].static_start == midnight24 && midnight24 == p.prepaid[weekDay].static_end)) {
|
||||
effectiveStartTime = effectiveStartTime.addDays(1);
|
||||
weekDay = effectiveStartTime.date().dayOfWeek();
|
||||
qCritical() << __func__ << ":" << __LINE__
|
||||
<< "effectiveStartTime: new week day [" << weekDay << "] (Mon=1, Tue=2, ..., Sun=7)";
|
||||
}
|
||||
effectiveStartTime.setTime(p.prepaid[weekDay].static_end);
|
||||
qCritical() << __func__ << ":" << __LINE__ << "effectiveStartTime:"
|
||||
<< effectiveStartTime.toString(Qt::ISODate);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user