From 87b14ee3f886712e051ce47ccbbe4abdd02bcceb Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Wed, 28 Feb 2024 09:26:51 +0100 Subject: [PATCH] Added check for NEUHAUSER_NORDISCHES_AUSBILDUNGSZENTRUM: 08:00 <= currentTime <= 20:00. --- library/src/calculate_price.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/library/src/calculate_price.cpp b/library/src/calculate_price.cpp index a5254d0..50ecb09 100644 --- a/library/src/calculate_price.cpp +++ b/library/src/calculate_price.cpp @@ -91,7 +91,18 @@ int CALCULATE_LIBRARY_API compute_product_price(Configuration const *cfg, PERMIT QVector product = products.value(); if (product.size() > 0) { ATBTariffProduct const &p = product[0]; - return p.m_tariff_product_price; + QTime const ¤tTime = 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;