checkin for tariff02.json

This commit is contained in:
Gerhard Hoffmann 2024-07-26 10:59:45 +02:00
parent 8344b04b15
commit b7facb9d60
6 changed files with 267 additions and 19 deletions

View File

@ -93,6 +93,7 @@ public:
bool isDayIncludedAsSpecialDay(uint64_t businessHours, int specialDayId) const;
std::optional<QVector<ATBPaymentRate>> getPaymentRateForAllKeys() const;
std::optional<QVector<ATBPaymentOption>> getPaymentOptionsForAllKeys() const;
std::optional<ATBPaymentOption> getPaymentOptionForId(int key) const;
std::optional<QVector<ATBPaymentRate>> getPaymentRateForKey(int key) const;
std::optional<ATBPaymentOption> getPaymentOptionForKey(PERMIT_TYPE permitType) const;
std::optional<ATBPaymentOption> getPaymentOptionForKey(int permitType) const;
@ -108,6 +109,7 @@ public:
std::optional<QVector<ATBTariffProduct>> getTariffProductForProductTypeName(QString const &permitTypeName) const;
std::optional<ATBCustomer> getCustomerForType(ATBCustomer::CustomerType customerType);
std::optional<ATBWeekDaysWorktime> getWeekDayWorkTime(QTime const &time, Qt::DayOfWeek dayOfWeek);
std::optional<QVector<ATBWeekDaysWorktime>> getAllWeekDayWorkTimes();
std::optional<QDateTime> prepaidStart(QDateTime const &start, int prepaid_option_id);
int getPaymentOptionIndex(PERMIT_TYPE permitType);

View File

@ -38,6 +38,8 @@ public:
pop_daily_card_price = -1;
pop_business_hours = -1;
pop_time_step_config = -1;
pop_use_only_upto_datetime = "";
pop_use_only_for_duration = 0;
}
int pop_id;
@ -45,6 +47,8 @@ public:
int pop_product_id;
QString pop_product_name;
int pop_payment_method_id;
QString pop_use_only_upto_datetime;
int pop_use_only_for_duration;
std::string pop_day_end_time;
std::string pop_day_night_end_time;
double pop_price_night;

View File

@ -4,8 +4,10 @@
class ATBWeekDaysWorktime
{
public:
int pwd_id;
int pwd_period_week_day_id;
int pwd_id;
int pwd_pop_id;
int pwd_next_id;
int pwd_period_week_day_id;
int pwd_period_day_in_week_id;
std::string pwd_time_from;
std::string pwd_time_to;

View File

@ -36,9 +36,14 @@ int CALCULATE_LIBRARY_API get_minimal_parkingtime(Configuration const *cfg,
paymentOptionIndex = cfg->getPaymentOptionIndex(permitType);
qCritical() << __func__ << __LINE__ << "paymentOptionIndex" << paymentOptionIndex;
qCritical() << __func__ << __LINE__ << "permit" << PermitType(permitType).toString();
switch(permitType) {
case PERMIT_TYPE::SHORT_TERM_PARKING: { // e.g. szeged (customer_281)
qCritical() << __LINE__ << Calculator::GetInstance().GetTimeSteps((Configuration *)cfg, paymentOptionIndex);
minTime = cfg->getPaymentOptions(paymentOptionIndex).pop_min_time;
qCritical() << __func__ << __LINE__ << minTime;
} break;
case PERMIT_TYPE::DAY_TICKET_ADULT: {
} break;
@ -50,10 +55,11 @@ int CALCULATE_LIBRARY_API get_minimal_parkingtime(Configuration const *cfg,
// for each new sell-procedure, recomute the timesteps. implicitly, set
// the minimal parking time.
Calculator::GetInstance().ResetTimeSteps(paymentOptionIndex);
Calculator::GetInstance().GetTimeSteps((Configuration *)cfg, paymentOptionIndex);
qCritical() << __LINE__ << Calculator::GetInstance().GetTimeSteps((Configuration *)cfg, paymentOptionIndex);
minTime = qRound(cfg->getPaymentOptions(paymentOptionIndex).pop_min_time);
}
qCritical() << "minTime" << minTime;
return minTime;
}
@ -384,11 +390,13 @@ CalcState CALCULATE_LIBRARY_API init_tariff(parking_tariff_t **tariff, char cons
if (! (*tariff)->ParseJson(*tariff, json.toStdString().c_str())) {
delete *tariff;
*tariff = nullptr;
qCritical() << " ... error parsing tariff";
return calcState.set(CalcState::State::ERROR_PARSING_TARIFF);
}
} else {
delete *tariff;
*tariff = nullptr;
qCritical() << " ... error loading tariff";
return calcState.set(CalcState::State::ERROR_LOADING_TARIFF);
}
@ -427,19 +435,19 @@ int CALCULATE_LIBRARY_API compute_next_timestep(parking_tariff_t *tariff, int cu
PaymentMethod const paymentMethodId = Utilities::getPaymentMethodId(cfg);
switch (paymentMethodId) {
case PaymentMethod::Progressive:
qCritical() << " compute_next_timestep() paymentMethodId: Progressive";
qCritical() << __LINE__ << " compute_next_timestep() paymentMethodId: Progressive";
break;
case PaymentMethod::Degressive:
qCritical() << " compute_next_timestep() paymentMethodId: Degressive";
qCritical() << __LINE__ << " compute_next_timestep() paymentMethodId: Degressive";
break;
case PaymentMethod::Linear:
qCritical() << " compute_next_timestep() paymentMethodId: Linear";
qCritical() << __LINE__ << " compute_next_timestep() paymentMethodId: Linear";
break;
case PaymentMethod::Steps:
qCritical() << " compute_next_timestep() paymentMethodId: Steps";
qCritical() << __LINE__ << " compute_next_timestep() paymentMethodId: Steps";
break;
case PaymentMethod::Undefined:
qCritical() << " compute_next_timestep() paymentMethodId: Undefined";
qCritical() << __LINE__ << " compute_next_timestep() paymentMethodId: Undefined";
break;
}
@ -607,7 +615,7 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
int netto_parking_time,
QDateTime &end_parking_time,
struct price_t *price,
PermitType /* permitType */,
PermitType permitType,
bool prepaid)
{
CalcState calcState;
@ -647,15 +655,30 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
double cost = -1;
if (start_parking_time.isValid()) {
if (tariff->getPaymentOptions(paymentOptionIndex).pop_payment_method_id == PaymentMethod::Steps) {
// qCritical() << __func__ << __LINE__;
if (tariff->getPaymentOptions(paymentOptionIndex).pop_payment_method_id == PaymentMethod::Steps ||
tariff->getPaymentOptions(paymentOptionIndex).pop_payment_method_id == PaymentMethod::Degressive) {
// qCritical() << __func__ << __LINE__;
// hier muesste man unterscheiden: uebertrag oder nicht?
calcState = Calculator::GetInstance().isParkingAllowed(tariff, start_parking_time,
netto_parking_time, paymentOptionIndex);
if (calcState.getStatus() == CalcState::State::OUTSIDE_ALLOWED_PARKING_TIME) {
// qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
// << calcState.toString();
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
<< calcState.toString();
// qCritical() << __func__ << __LINE__;
return calcState;
}
// qCritical() << __func__ << __LINE__;
QList<int> lll = Calculator::GetInstance().GetTimeSteps(tariff);
// netto_parking_time = compute_next_timestep(tariff, netto_parking_time, 1, permitType);
qCritical() << "LINE" << __LINE__ << "netto" << netto_parking_time << lll;
// qCritical() << __func__ << __LINE__;
cost = Calculator::GetInstance().GetCostFromDuration(tariff, start_parking_time, netto_parking_time, paymentOptionIndex);
end_parking_time = start_parking_time.addSecs(netto_parking_time*60);
@ -663,6 +686,7 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
// << "end_parking_time" << end_parking_time.toString(Qt::ISODate);
} else {
// qCritical() << __func__ << __LINE__;
cost = Calculator::GetInstance().GetCostFromDuration(
tariff,
tariff->getPaymentOptions().pop_payment_method_id,
@ -671,6 +695,7 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
netto_parking_time, // minutes, netto
false, prepaid);
}
// qCritical() << __func__ << __LINE__;
double minCost = tariff->getPaymentOptions(paymentOptionIndex).pop_min_price;
if (cost < minCost) {
calcState.setDesc(QString("line=%1 minCost=%2, cost=%3").arg(__LINE__).arg(minCost).arg(cost));

View File

@ -843,8 +843,11 @@ uint32_t Calculator::GetCostFromDuration(Configuration *cfg,
int paymentOptionIndex) const {
// for instance, a tariff as used in Schoenau, Koenigssee: only steps, no
// special days, nonstop.
qCritical() << __func__ << __LINE__;
static const PaymentMethod paymentMethodId = Utilities::getPaymentMethodId(cfg);
if (paymentMethodId == PaymentMethod::Steps) {
if (paymentMethodId == PaymentMethod::Steps ||
paymentMethodId == PaymentMethod::Degressive) {
QDateTime const end = start.addSecs(timeStepInMinutes*60);
return GetCostFromDuration(cfg, start, end, paymentOptionIndex);
}
@ -856,8 +859,15 @@ uint32_t Calculator::GetCostFromDuration(Configuration * cfg,
QDateTime const &end,
int paymentOptionIndex) const {
static const PaymentMethod paymentMethodId = Utilities::getPaymentMethodId(cfg);
if (paymentMethodId == PaymentMethod::Steps) {
qCritical() << __func__ << __LINE__;
if (paymentMethodId == PaymentMethod::Steps ||
paymentMethodId == PaymentMethod::Degressive) {
int const timeStepInMinutes = start.secsTo(end) / 60;
qCritical() << DBG_HEADER << "timeStepInMinutes" << timeStepInMinutes << start.toString(Qt::ISODate);
return GetPriceForTimeStep(cfg, timeStepInMinutes, paymentOptionIndex);
}
return 0;
@ -2186,6 +2196,135 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
int const step = Utilities::getTimeRangeStep(cfg, id, paymentMethodId);
m_timeSteps[paymentOptionIndex].append(step);
}
} else
if (paymentMethodId == PaymentMethod::Degressive) { // e.g. fuchs, valser alm (fane) (502)
// with growing time, the price goes down
// for instance: until 13.59: price 8, from 14:00: price 5, then for the next day: 8
// for the following days: 8 euros
qCritical() << "(" << __func__ << ":" << __LINE__ << ") degressive";
m_timeSteps[paymentOptionIndex].clear();
// lookup pop_next_id in worktimes;
std::optional<QVector<ATBWeekDaysWorktime>> const &w = cfg->getAllWeekDayWorkTimes();
if (w.has_value()) {
QVector<ATBWeekDaysWorktime> const &vec = w.value();
if (pop_carry_over) {
for (int i = 0; i < vec.size(); ++i) {
QTime const &from = QTime::fromString(QString::fromStdString(vec[i].pwd_time_from), Qt::ISODate);
QString const &toStr = QString::fromStdString(vec[i].pwd_time_to);
QTime const &to = QTime::fromString(toStr, Qt::ISODate);
int weekDayId = vec[i].pwd_period_day_in_week_id;
if (start.date().dayOfWeek() == weekDayId) {
//qCritical() << "(" << __func__ << ":" << __LINE__ << ")" << weekDayId;
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") from" << from.toString(Qt::ISODate);
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") to" << to.toString(Qt::ISODate);
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") start" << start.toString(Qt::ISODate);
if (start.time() >= from) {
qCritical() << "(" << __func__ << ":" << __LINE__ << ") from" << from.toString(Qt::ISODate);
if (start.time() < to) {
qCritical() << "(" << __func__ << ":" << __LINE__ << ") start" << start.toString(Qt::ISODate);
int runtimeInMinutes = (start.time().secsTo(to) / 60);
qCritical() << "(" << __func__ << ":" << __LINE__ << ") runTimeInMinutes" << runtimeInMinutes;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") index" << paymentOptionIndex;
m_timeSteps[paymentOptionIndex] << runtimeInMinutes;
cfg->getPaymentOptions(paymentOptionIndex).pop_min_time = runtimeInMinutes;
int pop_id = vec[i].pwd_pop_id;
int pwd_id = vec[i].pwd_id;
int pop_next_id = vec[i].pwd_next_id;
for (auto[itr, rangeEnd] = cfg->PaymentRate.equal_range(pop_id); itr != rangeEnd; ++itr) {
int const durationId = itr->second.pra_payment_unit_id;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") durationId" << durationId;
// int const price = itr->second.pra_price;
auto search = cfg->Duration.find(durationId);
if (search != cfg->Duration.end()) {
ATBDuration duration = search->second;
duration.pun_duration = runtimeInMinutes;
search->second = duration;
}
}
if (weekDayId == vec[pop_next_id].pwd_period_day_in_week_id) {
// on the same day
start.setTime(to);
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") next start" << start.toString(Qt::ISODate);
} else {
// on the next day
start.setTime(QTime::fromString(QString::fromStdString(vec[pop_next_id].pwd_time_from), Qt::ISODate));
start = start.addDays(1);
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") next start" << start.toString(Qt::ISODate);
}
while ((s.secsTo(start) / 60) < 5000) {
qCritical() << "(" << __func__ << ":" << __LINE__ << ") next start" << start.toString(Qt::ISODate);
pop_id = vec[i].pwd_pop_id;
pwd_id = vec[i].pwd_id;
pop_next_id = vec[i].pwd_next_id;
runtimeInMinutes += (start.time().secsTo(to) / 60);
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pwd_id " << pwd_id;
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pop_id " << pop_id;
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pop_next_id " << pop_next_id;
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") nextTimeStep" << nextTimeStep;
// ATBPaymentOption o = cfg->getPaymentOptionForId();
m_timeSteps[paymentOptionIndex] << runtimeInMinutes;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") XXXXXX pop" << pop_id;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") XXXXXX index" << paymentOptionIndex;
#if 0
for (auto[itr, rangeEnd] = cfg->PaymentRate.equal_range(pop_id); itr != rangeEnd; ++itr) {
int const durationId = itr->second.pra_payment_unit_id;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") XXXXXX durationId" << durationId;
// int const price = itr->second.pra_price;
auto search = cfg->Duration.find(durationId);
if (search != cfg->Duration.end()) {
ATBDuration duration = search->second;
duration.pun_duration = runtimeInMinutes;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") XXXXXX durationId" << runtimeInMinutes;
search->second = duration;
}
}
#endif
if (weekDayId == vec[pop_next_id].pwd_period_day_in_week_id) {
// on the same day
start.setTime(to);
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") next start" << start.toString(Qt::ISODate);
} else {
// on the next day
start.setTime(QTime::fromString(QString::fromStdString(vec[pop_next_id].pwd_time_from), Qt::ISODate));
start = start.addDays(1);
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") next start" << start.toString(Qt::ISODate);
}
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") until" << s.secsTo(start) / 60;
}
break;
}
}
}
}
}
}
} else {
uint16_t timeStepCompensation = 0;
@ -2312,10 +2451,12 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
}
}
qCritical() << "(" << __func__ << ":" << __LINE__ << ") runtime in minutes:" << runtimeInMinutes;
for (auto[itr, rangeEnd] = cfg->PaymentRate.equal_range(pop_id); itr != rangeEnd; ++itr) {
int const durationId = itr->second.pra_payment_unit_id;
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") durationId" << durationId;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") durationId" << durationId;
// int const price = itr->second.pra_price;
auto search = cfg->Duration.find(durationId);
@ -2332,7 +2473,7 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
break;
}
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") runtime in minutes (1):" << runtimeInMinutes;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") runtime in minutes:" << runtimeInMinutes;
std::optional<ATBInterpolation> ipolCheck = cfg->getInterpolationType(duration.pun_interpolation_id);
if (ipolCheck) {
@ -2393,6 +2534,11 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
} else
if (duration.pun_interpolation_id == (int)ATBInterpolation::NO_INTERPOLATION) {
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_id:" << duration.pun_id;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun duration:" << duration.pun_duration;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") next time step:" << nextTimeStep.toString(Qt::ISODate);
qCritical() << "(" << __func__ << ":" << __LINE__ << ") runtime in minutes (2):" << runtimeInMinutes;
if (paymentOptionIndex == 1) { // testing TODO: muss in die payment options hinein
if (runtimeInMinutes == 0) {
if (start.time() < carryOverStart) {
@ -2405,6 +2551,21 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
}
}
if (runtimeInMinutes == 0) {
if (start.time() < carryOverStart) {
runtimeInMinutes = start.time().secsTo(carryOverStart) / 60;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") runtime in minutes:" << runtimeInMinutes;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_id:" << duration.pun_id;
duration.pun_duration = runtimeInMinutes;
m_timeSteps[paymentOptionIndex] << duration.pun_duration;
search->second = duration;
cfg->getPaymentOptions(paymentOptionIndex).pop_min_time = runtimeInMinutes;
}
continue;
}
qCritical() << "(" << __func__ << ":" << __LINE__ << ") runtime in minutes:" << runtimeInMinutes;
QDateTime s = start.addSecs(runtimeInMinutes * 60);
int const minutes = s.time().secsTo(carryOverStart) / 60;
@ -2441,17 +2602,18 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
nextTimeStep.setTime(carryOverStart);
}
if (DBG_LEVEL >= DBG_DEBUG) {
//if (DBG_LEVEL >= DBG_DEBUG) {
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_id:" << duration.pun_id;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun duration:" << duration.pun_duration;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") next time step:" << nextTimeStep.toString(Qt::ISODate);
qCritical() << "(" << __func__ << ":" << __LINE__ << ") runtime in minutes (2):" << runtimeInMinutes;
}
//}
duration.pun_duration = runtimeInMinutes;
m_timeSteps[paymentOptionIndex] << duration.pun_duration;
search->second = duration;
} else {
qCritical() << "(" << __func__ << ":" << __LINE__ << ") HIER NICHT";
cfg->Duration.erase(search);
}
}
@ -2526,7 +2688,16 @@ uint32_t Calculator::GetPriceForTimeStep(Configuration *cfg, int timeStep, int p
Q_ASSERT(pun_id == payment_unit_id);
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_id" << pun_id;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_unit_id" << payment_unit_id;
qCritical() << "(" << __func__ << ":" << __LINE__ << ")" << cfg->Duration.find(1)->second.pun_duration;
qCritical() << "(" << __func__ << ":" << __LINE__ << ")" << cfg->Duration.find(2)->second.pun_duration;
qCritical() << "(" << __func__ << ":" << __LINE__ << ")" << cfg->Duration.find(3)->second.pun_duration;
int const pun_duration = cfg->Duration.find(payment_unit_id)->second.pun_duration;
//int const pun_duration = cfg->Duration.find(2)->second.pun_duration;
if (pop_accumulate_prices) {
price += itr->second.pra_price;
} else {
@ -2537,8 +2708,10 @@ uint32_t Calculator::GetPriceForTimeStep(Configuration *cfg, int timeStep, int p
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_id" << pun_id;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_unit_id" << payment_unit_id;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_duration" << pun_duration;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") timeStep" << timeStep;
if (timeStep == pun_duration) {
qCritical() << "(" << __func__ << ":" << __LINE__ << ") return price" << price;
return price;
}
}

View File

@ -589,6 +589,15 @@ bool Configuration::ParseJson(Configuration* cfg, const char* json)
QString const &s = QString::fromStdString(k->value.GetString());
this->currentPaymentOptions.last().pop_product_name = s;
}
} else if (strcmp(inner_obj_name, "pop_use_only_upto_datetime") == 0) {
if (k->value.IsString()) {
QString const &s = QString::fromStdString(k->value.GetString());
this->currentPaymentOptions.last().pop_use_only_upto_datetime = s;
}
} else if (strcmp(inner_obj_name, "pop_use_only_for_duration") == 0) {
if (k->value.IsInt()) {
this->currentPaymentOptions.last().pop_use_only_for_duration = k->value.GetInt();
}
} else if (strcmp(inner_obj_name, "pop_payment_method_id") == 0) {
this->currentPaymentOptions.last().pop_payment_method_id = k->value.GetInt();
} else if (strcmp(inner_obj_name, "pop_day_end_time") == 0) {
@ -719,6 +728,8 @@ bool Configuration::ParseJson(Configuration* cfg, const char* json)
break;*/
case MemberType::WeekDaysWorkTimeType:
if (strcmp(inner_obj_name, "pwd_id") == 0) WeekDaysWorktime.pwd_id = k->value.GetInt();
if (strcmp(inner_obj_name, "pwd_pop_id") == 0) WeekDaysWorktime.pwd_pop_id = k->value.GetInt();
if (strcmp(inner_obj_name, "pwd_next_id") == 0) WeekDaysWorktime.pwd_next_id = k->value.GetInt();
else if (strcmp(inner_obj_name, "pwd_period_week_day_id") == 0) WeekDaysWorktime.pwd_period_week_day_id = k->value.GetInt();
else if (strcmp(inner_obj_name, "pwd_period_day_in_week_id") == 0) WeekDaysWorktime.pwd_period_day_in_week_id = k->value.GetInt();
else if (strcmp(inner_obj_name, "pwd_time_from") == 0) WeekDaysWorktime.pwd_time_from = k->value.GetString();
@ -871,7 +882,7 @@ std::optional<QDateTime> Configuration::getInterpolationEnd(QDateTime const &sta
ATBInterpolation interpolation = ipolCheck.value();
switch (duration.pun_interpolation_id) {
case static_cast<int>(ATBInterpolation::NO_INTERPOLATION):
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") TODO";
qCritical() << "(" << __func__ << ":" << __LINE__ << ") NO_INTERPOLATION";
break;
case static_cast<int>(ATBInterpolation::STATIC_WALLCLOCK_TIME_VALUES):
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") TODO";
@ -1271,6 +1282,18 @@ Configuration::getDailyTicketsForKey(int key) const {
return value;
}
std::optional<ATBPaymentOption>
Configuration::getPaymentOptionForId(int key) const {
ATBPaymentOption option;
std::optional<ATBPaymentOption> value;
for (auto[it, rangeEnd] = this->PaymentOption.equal_range(key); it != rangeEnd; ++it) {
value = value.value_or(it->second);
}
return value;
}
std::optional<QVector<ATBPaymentOption>>
Configuration::getPaymentOptionsForAllKeys() const {
QVector<ATBPaymentOption> paymentOptions;
@ -1363,6 +1386,25 @@ Configuration::getCustomerForType(ATBCustomer::CustomerType customerType) {
return std::nullopt;
}
std::optional<QVector<ATBWeekDaysWorktime>>
Configuration::getAllWeekDayWorkTimes() {
QVector<ATBWeekDaysWorktime> worktimes;
std::optional<QVector<ATBWeekDaysWorktime>> value;
worktimes.clear();
for (std::multimap<int, ATBWeekDaysWorktime>::const_iterator it = this->WeekDaysWorktime.cbegin();
it != this->WeekDaysWorktime.cend(); ++it) {
worktimes.append(it->second);
}
if (worktimes.size() > 0) {
value = value.value_or(worktimes);
}
return value;
}
std::optional<ATBWeekDaysWorktime>
Configuration::getWeekDayWorkTime(QTime const &time, Qt::DayOfWeek dayOfWeek) {
ATBWeekDaysWorktime worktime;