Checking parking-time-limit:
provide start-date-time as well, because the limit counts only from one day to following day (e.g. Sunday to Monday or from holiday to next day).
This commit is contained in:
		| @@ -10,7 +10,9 @@ struct ATBTariffCarryOverSettings { | ||||
|  | ||||
|     // parking time limit not violated: return false, otherwise: return true. | ||||
|     using ParkingTimeLimitChecker = std::function<bool(ATBTariffCarryOverSettings const&, | ||||
|                                                        QDateTime const &endTime, int paymentOptionIndex)>; | ||||
|                                                        QDateTime const &startTime, | ||||
|                                                        QDateTime const &endTime, | ||||
|                                                        int paymentOptionIndex)>; | ||||
|  | ||||
|     int m_duration; | ||||
|     QTime m_start; | ||||
| @@ -24,7 +26,8 @@ struct ATBTariffCarryOverSettings { | ||||
|       : m_duration(0) | ||||
|       , m_start(QTime()) | ||||
|       , m_end(QTime()) | ||||
|       , m_parkingTimeLimitChecker([](ATBTariffCarryOverSettings const&, QDateTime const &, int) { return false; }) | ||||
|       , m_parkingTimeLimitChecker([](ATBTariffCarryOverSettings const&, | ||||
|                                   QDateTime const&, QDateTime const&, int) { return false; }) | ||||
|       , m_parking_time_limit(QTime()) | ||||
|       , m_about_to_exceed_parking_time_limit(QTime()) {} | ||||
|  | ||||
| @@ -41,8 +44,10 @@ struct ATBTariffCarryOverSettings { | ||||
|       , m_about_to_exceed_parking_time_limit(about_to_exceed_parking_time_limit) { | ||||
|     } | ||||
|  | ||||
|     bool parkingTimeLimitExceeded(QDateTime const &endTime, int paymentOptionIndex) const { | ||||
|         return m_parkingTimeLimitChecker(*this, endTime, paymentOptionIndex); | ||||
|     bool parkingTimeLimitExceeded(QDateTime const &startTime, | ||||
|                                   QDateTime const &endTime, | ||||
|                                   int paymentOptionIndex) const { | ||||
|         return m_parkingTimeLimitChecker(*this, startTime, endTime, paymentOptionIndex); | ||||
|     } | ||||
|  | ||||
|     friend QDebug operator<<(QDebug debug, ATBTariffCarryOverSettings const &co) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user