compute_duration_for_parking_ticket():

Set ticket end time to 23:59 (instaed of 00:00:00).
This commit is contained in:
Gerhard Hoffmann 2024-08-13 15:28:42 +02:00
parent b303a59964
commit fc78eff0a4

View File

@ -1005,15 +1005,20 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket(
} else { } else {
ticketEndTime = QDateTime::fromString(endTime,Qt::ISODate); ticketEndTime = QDateTime::fromString(endTime,Qt::ISODate);
// DEBUG
//qCritical() << "compute_duration_for_parking_ticket(): ";
//qCritical() << " endTime: " << endTime;
//qCritical() << " ticketEndTime: " << ticketEndTime;
if (!ticketEndTime.isValid()) { if (!ticketEndTime.isValid()) {
calcState.setDesc(QString("ticketEndTime=%1").arg(endTime)); calcState.setDesc(QString("ticketEndTime=%1").arg(endTime));
return calcState.set(CalcState::State::WRONG_ISO_TIME_FORMAT); return calcState.set(CalcState::State::WRONG_ISO_TIME_FORMAT);
} }
if (ticketEndTime.time().hour() == 0 && ticketEndTime.time().minute() == 0) {
ticketEndTime = ticketEndTime.addDays(-1);
ticketEndTime.setTime(QTime(23, 59, 0));
}
// DEBUG
qCritical() << "compute_duration_for_parking_ticket(): ";
qCritical() << " endTime: " << endTime;
qCritical() << " ticketEndTime: " << ticketEndTime;
} }
} else { } else {
return calcState.set(CalcState::State::INVALID_START_DATE); return calcState.set(CalcState::State::INVALID_START_DATE);