Compare commits
5 Commits
fix-kirchd
...
2.1.2
Author | SHA1 | Date | |
---|---|---|---|
588a88455b
|
|||
92bfdced6a
|
|||
8bbec596c9 | |||
87b14ee3f8 | |||
3ad2c77467 |
@@ -84,6 +84,51 @@ struct CALCULATE_LIBRARY_API CalcState {
|
||||
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 {
|
||||
QString s;
|
||||
switch (m_status) {
|
||||
|
@@ -92,6 +92,21 @@ int CALCULATE_LIBRARY_API compute_product_price(Configuration const *cfg, PERMIT
|
||||
if (product.size() > 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();
|
||||
|
||||
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) << ")";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
@@ -34,13 +34,13 @@ extern "C" char* strptime(const char* s,
|
||||
#include "calculator_functions.h"
|
||||
#include "calculate_price.h"
|
||||
|
||||
#define SZEGED (1)
|
||||
#define SZEGED (0)
|
||||
#define SCHOENAU_KOENIGSEE (0)
|
||||
#define NEUHAUSER_KORNEUBURG (0)
|
||||
#define NEUHAUSER_LINSINGER_MASCHINENBAU (0)
|
||||
#define NEUHAUSER_NORDISCHES_AUSBILDUNGSZENTRUM (0)
|
||||
#define NEUHAUSER_NORDISCHES_AUSBILDUNGSZENTRUM (1)
|
||||
#define NEUHAUSER_BILEXA_GALTUER (0)
|
||||
#define NEUHAUSER_KIRCHDORF (1)
|
||||
#define NEUHAUSER_KIRCHDORF (0)
|
||||
|
||||
#if NEUHAUSER_KIRCHDORF==1
|
||||
static bool test_neuhauser_kirchdorf(int step, double cost) {
|
||||
@@ -429,13 +429,12 @@ int main() {
|
||||
|
||||
QDateTime end2 = QDateTime();
|
||||
if (compute_duration_for_parking_ticket(&cfg, start, cost, end2)) { // return value
|
||||
qCritical() << "XXXX start" << start.toString(Qt::ISODate)
|
||||
qCritical() << "start" << start.toString(Qt::ISODate)
|
||||
<< "offset" << offset
|
||||
<< "cost" << cost
|
||||
<< "end" << end2.toString(Qt::ISODate);
|
||||
if (end != end2) {
|
||||
qCritical() << "YYYY"
|
||||
<< end.toString(Qt::ISODate)
|
||||
qCritical() << end.toString(Qt::ISODate)
|
||||
<< end2.toString(Qt::ISODate);
|
||||
}
|
||||
}
|
||||
@@ -603,39 +602,28 @@ int main() {
|
||||
int w = compute_product_price(&cfg, PERMIT_TYPE::DAY_TICKET_TEEN);
|
||||
qCritical() << "price teen" << w;
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
|
||||
QDateTime s(QDate(2023, 11, 30), QTime());
|
||||
QDateTime end;
|
||||
struct price_t price;
|
||||
#define ADULT 0
|
||||
#define TEEN 1
|
||||
#define ADULT 1
|
||||
//#define TEEN 1
|
||||
|
||||
for (int offset = 480; offset < 1200; ++offset) {
|
||||
QDateTime start = s.addSecs(offset * 60);
|
||||
CalcState cs = compute_price_for_daily_ticket(&cfg, start, end,
|
||||
#if ADULT==1
|
||||
for (int offset = 480; offset < 1080; ++offset) {
|
||||
QDateTime start = s.addSecs(offset * 60);
|
||||
|
||||
// qCritical() << QString(Calculator::GetInstance().isParkingAllowed(&cfg, start));
|
||||
|
||||
CalcState cs = compute_price_for_daily_ticket(&cfg, start, end,
|
||||
PERMIT_TYPE::DAY_TICKET_ADULT, &price);
|
||||
PERMIT_TYPE::DAY_TICKET_ADULT,
|
||||
#elif TEEN==1
|
||||
PERMIT_TYPE::DAY_TICKET_TEEN,
|
||||
#endif
|
||||
&price);
|
||||
qCritical() << "start=" << start.toString(Qt::ISODate)
|
||||
<< "end" << end.toString(Qt::ISODate) << "price" << price.netto;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TEEN==1
|
||||
for (int offset = 480; offset < 1080; ++offset) {
|
||||
QDateTime start = s.addSecs(offset * 60);
|
||||
CalcState cs = compute_price_for_daily_ticket(&cfg, start, end,
|
||||
PERMIT_TYPE::DAY_TICKET_TEEN, &price);
|
||||
qCritical() << "start=" << start.toString(Qt::ISODate)
|
||||
<< "end" << end.toString(Qt::ISODate) << "price" << price.netto;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#undef ADULT
|
||||
#undef TEEN
|
||||
#endif
|
||||
|
||||
#if NEUHAUSER_LINSINGER_MASCHINENBAU==1
|
||||
|
Reference in New Issue
Block a user