Added check for NEUHAUSER_NORDISCHES_AUSBILDUNGSZENTRUM:

08:00 <= currentTime <= 20:00.
This commit is contained in:
Gerhard Hoffmann 2024-02-28 09:26:51 +01:00
parent 3ad2c77467
commit 87b14ee3f8

View File

@ -91,7 +91,18 @@ int CALCULATE_LIBRARY_API compute_product_price(Configuration const *cfg, PERMIT
QVector<ATBTariffProduct> product = products.value(); QVector<ATBTariffProduct> product = products.value();
if (product.size() > 0) { if (product.size() > 0) {
ATBTariffProduct const &p = product[0]; ATBTariffProduct const &p = product[0];
return p.m_tariff_product_price; QTime const &currentTime = QDateTime::currentDateTime().time();
if (p.m_tariff_product_start <= currentTime && currentTime <= p.m_tariff_product_end) {
return p.m_tariff_product_price;
} else {
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
<< "ERROR currentTime"
<< currentTime.toString(Qt::ISODate)
<< "INVALID ("
<< p.m_tariff_product_start.toString(Qt::ISODate)
<< p.m_tariff_product_end.toString(Qt::ISODate) << ")";
}
} }
} }
} break; } break;