Use free function getPaymentOptionIndex() to compute index of valid
payment-option-section in tariff-file based on configured businessHours.
This commit is contained in:
parent
f92906f680
commit
5cab0de9fb
@ -133,7 +133,13 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
|
|||||||
QDateTime inputDate = QDateTime::fromString(startDatetimePassed, Qt::ISODate);
|
QDateTime inputDate = QDateTime::fromString(startDatetimePassed, Qt::ISODate);
|
||||||
inputDate.setTime(QTime(inputDate.time().hour(), inputDate.time().minute(), 0));
|
inputDate.setTime(QTime(inputDate.time().hour(), inputDate.time().minute(), 0));
|
||||||
static const PaymentMethod paymentMethodId = Utilities::getPaymentMethodId(cfg);
|
static const PaymentMethod paymentMethodId = Utilities::getPaymentMethodId(cfg);
|
||||||
int const paymentOptionIndex = cfg->getPaymentOptionIndex(permitType.get());
|
|
||||||
|
int paymentOptionIndex = getPaymentOptionIndex(*cfg);
|
||||||
|
if (paymentOptionIndex == -1) {
|
||||||
|
paymentOptionIndex = cfg->getPaymentOptionIndex(QDateTime::fromString(startDatetimePassed, Qt::ISODate));
|
||||||
|
}
|
||||||
|
|
||||||
|
qCritical() << DBG_HEADER << " option index:" << paymentOptionIndex;
|
||||||
|
|
||||||
if (DBG_LEVEL >= DBG_DEBUG) {
|
if (DBG_LEVEL >= DBG_DEBUG) {
|
||||||
qCritical() << DBG_HEADER << " start:" << inputDate.toString(Qt::ISODate);
|
qCritical() << DBG_HEADER << " start:" << inputDate.toString(Qt::ISODate);
|
||||||
@ -1420,7 +1426,10 @@ double Calculator::GetCostFromDuration(Configuration* cfg,
|
|||||||
Q_UNUSED(payment_option);
|
Q_UNUSED(payment_option);
|
||||||
Q_UNUSED(nextDay);
|
Q_UNUSED(nextDay);
|
||||||
|
|
||||||
int const paymentOptionIndex = cfg->getPaymentOptionIndex(permitType.get());
|
int paymentOptionIndex = getPaymentOptionIndex(*cfg);
|
||||||
|
if (paymentOptionIndex == -1) {
|
||||||
|
paymentOptionIndex = cfg->getPaymentOptionIndex(permitType.get());
|
||||||
|
}
|
||||||
static const PaymentMethod paymentMethodId = Utilities::getPaymentMethodId(cfg);
|
static const PaymentMethod paymentMethodId = Utilities::getPaymentMethodId(cfg);
|
||||||
if (paymentMethodId == PaymentMethod::Steps) {
|
if (paymentMethodId == PaymentMethod::Steps) {
|
||||||
if (tariffIs24_7(cfg)) {
|
if (tariffIs24_7(cfg)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user