Compare commits
No commits in common. "b43fa274bd149d2ad1f7a99f4a7b3f2dc01590c9" and "0671a6dde65e96f7ef00ecc57c798033c5d45c77" have entirely different histories.
b43fa274bd
...
0671a6dde6
@ -111,8 +111,7 @@ int CALCULATE_LIBRARY_API get_zone_nr(int zone = -1);
|
||||
|
||||
int CALCULATE_LIBRARY_API compute_next_timestep(parking_tariff_t *tariff, int currentTimeMinutes, int UpDown);
|
||||
|
||||
QList<int> CALCULATE_LIBRARY_API get_time_steps(Configuration *cfg);
|
||||
int CALCULATE_LIBRARY_API get_minimum_parkingtime(Configuration *cfg);
|
||||
QList<int> CALCULATE_LIBRARY_API get_time_steps(Configuration *cfg, qint64 startInMinutes = QDateTime::currentSecsSinceEpoch() / 60);
|
||||
|
||||
CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket( // deprecated
|
||||
parking_tariff_t *tariff,
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
// helper function to find time steps for a tariff with PaymentMethod::Steps
|
||||
// (e.g. Schoenau/Koenigsee)
|
||||
//
|
||||
QList<int> GetTimeSteps(Configuration *cfg) const;
|
||||
QList<int> GetTimeSteps(Configuration *cfg, quint64 startInMinutes = QDateTime::currentSecsSinceEpoch() / 60) const;
|
||||
QList<int> GetSteps(Configuration *cfg) const { return GetTimeSteps(cfg); }
|
||||
|
||||
// additional helper functions
|
||||
|
@ -12,15 +12,8 @@
|
||||
|
||||
static Calculator calculator;
|
||||
|
||||
QList<int> CALCULATE_LIBRARY_API get_time_steps(Configuration *cfg) {
|
||||
return calculator.GetTimeSteps(cfg);
|
||||
}
|
||||
|
||||
int CALCULATE_LIBRARY_API get_minimum_parkingtime(Configuration *cfg) {
|
||||
// get_time_steps() possibly re-computes pop_min_time: see
|
||||
// calculator.GetTimeSteps()
|
||||
get_time_steps(cfg);
|
||||
return qRound(cfg->getPaymentOptions().pop_min_time);
|
||||
QList<int> CALCULATE_LIBRARY_API get_time_steps(Configuration *cfg, qint64 startInMinutes) {
|
||||
return calculator.GetTimeSteps(cfg, startInMinutes);
|
||||
}
|
||||
|
||||
int CALCULATE_LIBRARY_API get_zone_nr(int zone)
|
||||
|
@ -695,22 +695,21 @@ Ticket Calculator::private_GetDurationFromCost(Configuration *cfg,
|
||||
cost, Ticket::s[VALID]);
|
||||
}
|
||||
|
||||
QList<int> Calculator::GetTimeSteps(Configuration *cfg) const {
|
||||
QList<int> timeSteps;
|
||||
|
||||
QDateTime start = QDateTime::currentDateTime();
|
||||
start.setTime(QTime(start.time().hour(), start.time().minute(), 0));
|
||||
QList<int> Calculator::GetTimeSteps(Configuration *cfg, quint64 startInMinutes) const {
|
||||
static QList<int> timeSteps;
|
||||
|
||||
if (timeSteps.size() == 0) {
|
||||
int const pop_id = cfg->getPaymentOptions().pop_id;
|
||||
int const pop_carry_over = cfg->getPaymentOptions().pop_carry_over;
|
||||
int const pop_time_step_config = cfg->getPaymentOptions().pop_time_step_config;
|
||||
|
||||
qCritical() << " start parking time:" << start.toString(Qt::ISODate);
|
||||
qCritical() << " payment option id:" << pop_id;
|
||||
qCritical() << " payment option carry over:" << pop_carry_over;
|
||||
qCritical() << "payment option time step config:" << pop_time_step_config;
|
||||
|
||||
if (pop_time_step_config == (int)ATBTimeStepConfig::TimeStepConfig::DYNAMIC) {
|
||||
QDateTime start;
|
||||
start.setSecsSinceEpoch(startInMinutes * 60);
|
||||
uint16_t timeStepCompensation = 0;
|
||||
|
||||
if (pop_carry_over) {
|
||||
@ -777,6 +776,7 @@ QList<int> Calculator::GetTimeSteps(Configuration *cfg) const {
|
||||
timeSteps << durationUnit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return timeSteps;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user