Compare commits
3 Commits
40440e28d3
...
abf4ef0b00
Author | SHA1 | Date | |
---|---|---|---|
abf4ef0b00 | |||
49fb860129 | |||
69edc8e898 |
@ -213,6 +213,26 @@ int CALCULATE_LIBRARY_API compute_product_price(Configuration const *cfg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
case PERMIT_TYPE::SHORT_TERM_PARKING_PKW: {
|
||||||
|
qCritical() << "TODO: SHORT_TERM_PARKING_PKW";
|
||||||
|
} break;
|
||||||
|
case PERMIT_TYPE::SHORT_TERM_PARKING_BUS: {
|
||||||
|
qCritical() << "TODO: SHORT_TERM_PARKING_BUS";
|
||||||
|
} break;
|
||||||
|
case PERMIT_TYPE::SHORT_TERM_PARKING_CAMPER: {
|
||||||
|
qCritical() << "TODO: SHORT_TERM_PARKING_CAMPER";
|
||||||
|
} break;
|
||||||
|
case PERMIT_TYPE::DAY_TICKET_PKW: {
|
||||||
|
int const pop_daily_card_price = cfg->getPaymentOptions().pop_daily_card_price;
|
||||||
|
qCritical() << "DAY_TICKET_PKW: daily ticket price" << pop_daily_card_price;
|
||||||
|
return pop_daily_card_price;
|
||||||
|
} break;
|
||||||
|
case PERMIT_TYPE::DAY_TICKET_BUS: {
|
||||||
|
qCritical() << "TODO: DAY_TICKET_BUS";
|
||||||
|
} break;
|
||||||
|
case PERMIT_TYPE::DAY_TICKET_CAMPER: {
|
||||||
|
qCritical() << "TODO: DAY_TICKET_CAMPER";
|
||||||
|
} break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -586,7 +606,7 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
|
|||||||
}
|
}
|
||||||
double minCost = tariff->getPaymentOptions(paymentOptionIndex).pop_min_price;
|
double minCost = tariff->getPaymentOptions(paymentOptionIndex).pop_min_price;
|
||||||
if (cost < minCost) {
|
if (cost < minCost) {
|
||||||
calcState.setDesc(QString("minCost=%1, cost=%2").arg(minCost, cost));
|
calcState.setDesc(QString("minCost=%1, cost=%2").arg(minCost).arg(cost));
|
||||||
return calcState.set(CalcState::State::BELOW_MIN_PARKING_PRICE);
|
return calcState.set(CalcState::State::BELOW_MIN_PARKING_PRICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2448,6 +2448,9 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
|
|||||||
uint32_t Calculator::GetPriceForTimeStep(Configuration *cfg, int timeStep, int paymentOptionIndex) const {
|
uint32_t Calculator::GetPriceForTimeStep(Configuration *cfg, int timeStep, int paymentOptionIndex) const {
|
||||||
|
|
||||||
int const pop_id = cfg->getPaymentOptions(paymentOptionIndex).pop_id;
|
int const pop_id = cfg->getPaymentOptions(paymentOptionIndex).pop_id;
|
||||||
|
int const pop_accumulate_prices = cfg->getPaymentOptions(paymentOptionIndex).pop_accumulate_prices;
|
||||||
|
|
||||||
|
uint32_t price = 0;
|
||||||
|
|
||||||
for (auto[itr, rangeEnd] = cfg->PaymentRate.equal_range(pop_id); itr != rangeEnd; ++itr)
|
for (auto[itr, rangeEnd] = cfg->PaymentRate.equal_range(pop_id); itr != rangeEnd; ++itr)
|
||||||
{
|
{
|
||||||
@ -2457,8 +2460,14 @@ uint32_t Calculator::GetPriceForTimeStep(Configuration *cfg, int timeStep, int p
|
|||||||
Q_ASSERT(pun_id == payment_unit_id);
|
Q_ASSERT(pun_id == payment_unit_id);
|
||||||
|
|
||||||
int const pun_duration = cfg->Duration.find(payment_unit_id)->second.pun_duration;
|
int const pun_duration = cfg->Duration.find(payment_unit_id)->second.pun_duration;
|
||||||
|
if (pop_accumulate_prices) {
|
||||||
|
price += itr->second.pra_price;
|
||||||
|
} else {
|
||||||
|
price = (uint32_t)(itr->second.pra_price);
|
||||||
|
}
|
||||||
|
|
||||||
if (timeStep == pun_duration) {
|
if (timeStep == pun_duration) {
|
||||||
return (uint32_t)(itr->second.pra_price);
|
return price;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user