Compare commits

...

3 Commits

2 changed files with 49 additions and 0 deletions

View File

@@ -84,6 +84,51 @@ struct CALCULATE_LIBRARY_API CalcState {
return (m_status == State::SUCCESS); return (m_status == State::SUCCESS);
} }
QString toString() {
QString s;
switch (m_status) {
case State::SUCCESS:
s = "SUCCESS";
break;
case State::ERROR_PARSING_ZONE_NR:
s = "ERROR_PARSING_ZONE_NR";
break;
case State::ERROR_LOADING_TARIFF:
s = "ERROR_LOADING_TARIFF";
break;
case State::ERROR_PARSING_TARIFF:
s = "ERROR_PARSING_TARIFF";
break;
case State::NEGATIVE_PARING_TIME:
s = "NEGATIVE_PARKING_TIME";
break;
case State::ABOVE_MAX_PARKING_TIME:
s = "ABOVE_MAX_PARKING_TIME";
break;
case State::WRONG_PARAM_VALUES:
s = "WRONG_PARAM_VALUES";
break;
case State::BELOW_MIN_PARKING_TIME:
s = "BELOW_MIN_PARKING_TIME";
break;
case State::BELOW_MIN_PARKING_PRICE:
s = "BELOW_MIN_PARKING_PRICE";
break;
case State::OVERPAID:
s = "OVERPAID";
break;
case State::INVALID_START_DATE:
s = "INVALID_START_DATE";
break;
case State::WRONG_ISO_TIME_FORMAT:
s = "WRONG_ISO_TIME_FORMAT";
break;
case State::OUTSIDE_ALLOWED_PARKING_TIME:
s = "OUTSIDE_ALLOWED_PARKING_TIME";
}
return s + ":" + m_desc;
}
explicit operator QString () const noexcept { explicit operator QString () const noexcept {
QString s; QString s;
switch (m_status) { switch (m_status) {

View File

@@ -91,6 +91,9 @@ 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;
#if 0
// in case we do not have prepaid-option
QTime const &currentTime = QDateTime::currentDateTime().time(); QTime const &currentTime = QDateTime::currentDateTime().time();
if (p.m_tariff_product_start <= currentTime && currentTime <= p.m_tariff_product_end) { if (p.m_tariff_product_start <= currentTime && currentTime <= p.m_tariff_product_end) {
@@ -103,6 +106,7 @@ int CALCULATE_LIBRARY_API compute_product_price(Configuration const *cfg, PERMIT
<< p.m_tariff_product_start.toString(Qt::ISODate) << p.m_tariff_product_start.toString(Qt::ISODate)
<< p.m_tariff_product_end.toString(Qt::ISODate) << ")"; << p.m_tariff_product_end.toString(Qt::ISODate) << ")";
} }
#endif
} }
} }
} break; } break;