Compare commits
3 Commits
87b14ee3f8
...
2.1.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
588a88455b
|
|||
|
92bfdced6a
|
|||
| 8bbec596c9 |
@@ -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) {
|
||||||
|
|||||||
@@ -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 ¤tTime = QDateTime::currentDateTime().time();
|
QTime const ¤tTime = 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;
|
||||||
|
|||||||
Reference in New Issue
Block a user