Return a ticket from private_GetCostFromDuration().
Add helpers findWorkTimeRange() and findNextWorkTimeRange().
This commit is contained in:
		| @@ -1,7 +1,14 @@ | ||||
| #pragma once | ||||
| #ifndef CALCULATOR_FUNCTIONS_H_INCLUDED | ||||
| #define CALCULATOR_FUNCTIONS_H_INCLUDED | ||||
|  | ||||
| #include <iostream> | ||||
| #include <optional> | ||||
|  | ||||
| #include "configuration.h" | ||||
| #include "payment_method.h" | ||||
| #include "ticket.h" | ||||
| #include "tariff_time_range.h" | ||||
|  | ||||
| #include <QDateTime> | ||||
| using namespace std; | ||||
|  | ||||
| @@ -49,13 +56,13 @@ private: | ||||
|     int getMinimalParkingTime(Configuration const *cfg, PaymentMethod methodId); | ||||
|     int getMaximalParkingTime(Configuration const *cfg, PaymentMethod methodId); | ||||
|  | ||||
|     uint32_t private_GetCostFromDuration(Configuration const* cfg, | ||||
|                                          QDateTime const &start, | ||||
|                                          QDateTime &end, | ||||
|                                          int durationMinutes, | ||||
|                                          bool nextDay = false, | ||||
|                                          bool prepaid = false, | ||||
|                                          bool overtime = false); | ||||
|     Ticket private_GetCostFromDuration(Configuration const* cfg, | ||||
|                                        QDateTime const &start, | ||||
|                                        QDateTime &end, | ||||
|                                        int &durationMinutes, | ||||
|                                        bool nextDay = false, | ||||
|                                        bool prepaid = false, | ||||
|                                        bool overtime = false); | ||||
|  | ||||
|     bool checkDurationMinutes(bool overTime, | ||||
|                               int minParkingTime, int maxParkingTime, | ||||
| @@ -64,4 +71,13 @@ private: | ||||
|     // | ||||
|     uint32_t GetPriceForTimeStep(Configuration *cfg, int timeStep) const; | ||||
|     uint32_t GetDurationForPrice(Configuration *cfg, int price) const; | ||||
|  | ||||
|     int findWorkTimeRange(QDateTime const &dt, | ||||
|                           QScopedArrayPointer<TariffTimeRange> const &worktime, | ||||
|                           size_t size); | ||||
|     int findNextWorkTimeRange(QDateTime const &dt, | ||||
|                               QScopedArrayPointer<TariffTimeRange> const &worktime, | ||||
|                               size_t size); | ||||
| }; | ||||
|  | ||||
| #endif // CALCULATOR_FUNCTIONS_H_INCLUDED | ||||
|   | ||||
		Reference in New Issue
	
	Block a user