test for valser alm (fane)
This commit is contained in:
parent
52b7c2390a
commit
7233bc55c2
140
main/main.cpp
140
main/main.cpp
@ -801,7 +801,7 @@ int main() {
|
|||||||
int pop_max_price;
|
int pop_max_price;
|
||||||
int pop_daily_card_price;
|
int pop_daily_card_price;
|
||||||
|
|
||||||
int zone = 1;
|
int zone = 3;
|
||||||
|
|
||||||
if (zone == 1) {
|
if (zone == 1) {
|
||||||
input.open("/opt/ptu5/opt/customer_502/etc/psa_tariff/tariff01.json");
|
input.open("/opt/ptu5/opt/customer_502/etc/psa_tariff/tariff01.json");
|
||||||
@ -824,7 +824,7 @@ int main() {
|
|||||||
|
|
||||||
if (isParsed) {
|
if (isParsed) {
|
||||||
|
|
||||||
if (zone == 1) {
|
if (zone == 1 || zone == 3) {
|
||||||
/*
|
/*
|
||||||
pop_min_time = get_minimal_parkingtime(&cfg, PERMIT_TYPE::SHORT_TERM_PARKING_PKW);
|
pop_min_time = get_minimal_parkingtime(&cfg, PERMIT_TYPE::SHORT_TERM_PARKING_PKW);
|
||||||
pop_max_time = get_maximal_parkingtime(&cfg, PERMIT_TYPE::SHORT_TERM_PARKING_PKW);
|
pop_max_time = get_maximal_parkingtime(&cfg, PERMIT_TYPE::SHORT_TERM_PARKING_PKW);
|
||||||
@ -848,7 +848,8 @@ int main() {
|
|||||||
qCritical() << " pop_min_price_bus: " << pop_min_price;
|
qCritical() << " pop_min_price_bus: " << pop_min_price;
|
||||||
qCritical() << " pop_max_price_bus: " << pop_max_price;
|
qCritical() << " pop_max_price_bus: " << pop_max_price;
|
||||||
*/
|
*/
|
||||||
} else {
|
}
|
||||||
|
if (zone == 2) {
|
||||||
pop_min_time = get_minimal_parkingtime(&cfg);
|
pop_min_time = get_minimal_parkingtime(&cfg);
|
||||||
pop_max_time = get_maximal_parkingtime(&cfg);
|
pop_max_time = get_maximal_parkingtime(&cfg);
|
||||||
pop_min_price = get_minimal_parkingprice(&cfg);
|
pop_min_price = get_minimal_parkingprice(&cfg);
|
||||||
@ -897,7 +898,7 @@ int main() {
|
|||||||
//qCritical() << calcState.toString();
|
//qCritical() << calcState.toString();
|
||||||
|
|
||||||
calcState = compute_duration_for_parking_ticket(&cfg, s,
|
calcState = compute_duration_for_parking_ticket(&cfg, s,
|
||||||
(double)6000, end, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING_BUS));
|
(double)9000, end, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING_BUS));
|
||||||
qCritical() << end.toString(Qt::ISODate);
|
qCritical() << end.toString(Qt::ISODate);
|
||||||
qCritical() << calcState.toString();
|
qCritical() << calcState.toString();
|
||||||
}
|
}
|
||||||
@ -957,89 +958,62 @@ int main() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (zone == 3) {
|
if (zone == 3) {
|
||||||
int price;
|
//QDateTime xx(QDateTime::fromString("2024-07-31T00:00:00", Qt::ISODate));
|
||||||
QDateTime productStart;
|
//xx = xx.addSecs(-60); // --> "2024-07-30T23:59:00"
|
||||||
QDateTime productEnd;
|
//qCritical() << xx.toString(Qt::ISODate);
|
||||||
QDateTime start = QDateTime::currentDateTime();
|
|
||||||
|
|
||||||
#if 0
|
//QDateTime s(QDateTime::currentDateTime());
|
||||||
start.setTime(QTime(0, 0, 0));
|
//s.setTime(QTime(12, 0, 0));
|
||||||
price = compute_product_price(&cfg, PERMIT_TYPE::DAY_TICKET, start);
|
//QList<int> timeSteps = Calculator::GetInstance().GetTimeSteps(&cfg, 0, s);
|
||||||
qCritical() << QString("line=%1 price (%2) :")
|
//qCritical() << timeSteps;
|
||||||
.arg(__LINE__)
|
int Down = 0;
|
||||||
.arg(start.time().toString(Qt::ISODate)) << price;
|
int Up = 1;
|
||||||
|
|
||||||
price = get_minimal_parkingprice(&cfg, PERMIT_TYPE::DAY_TICKET, 0, start);
|
QDateTime const start = QDateTime::currentDateTime();
|
||||||
qCritical() << QString("line=%1 get_minimal_parkingprice:").arg(__LINE__) << price;
|
int paymentOptionIndex = cfg.getPaymentOptionIndex(PERMIT_TYPE::SHORT_TERM_PARKING_PKW);
|
||||||
|
|
||||||
start.setTime(QTime(14, 0, 0));
|
if (paymentOptionIndex != 0) {
|
||||||
productStart = productEnd = QDateTime();
|
qCritical() << "ERROR paymentOptionIndex" << paymentOptionIndex
|
||||||
price = compute_product_price(&cfg, PERMIT_TYPE::DAY_TICKET, start, &productStart, &productEnd);
|
<< "< 0 for start" << start.toString(Qt::ISODate);
|
||||||
qCritical() << QString("line=%1 price (%2-%3) :")
|
exit(-1);
|
||||||
.arg(__LINE__)
|
}
|
||||||
.arg(productStart.time().toString(Qt::ISODate))
|
|
||||||
.arg(productEnd.time().toString(Qt::ISODate))
|
//QSet<uint32_t> const prices1{800, 1600, 2400, 3200, 4000, 4800, 5600};
|
||||||
<< price;
|
//QSet<uint32_t> const prices2{500, 1600, 2400, 3200, 4000, 4800, 5600};
|
||||||
|
|
||||||
price = get_minimal_parkingprice(&cfg, PERMIT_TYPE::DAY_TICKET, 0, start);
|
QDateTime end;
|
||||||
qCritical() << QString("line=%1 get_minimal_parkingprice:").arg(__LINE__)
|
CalcState calcState;
|
||||||
<< price;
|
|
||||||
|
QDateTime s(QDateTime::currentDateTime());
|
||||||
price = compute_product_price(&cfg, PERMIT_TYPE::DAY_TICKET, start);
|
s.setTime(QTime(12, 0, 0));
|
||||||
qCritical() << QString("line=%1 price:").arg(__LINE__) << price;
|
|
||||||
|
int minimal_parking_price = get_minimal_parkingprice(&cfg,
|
||||||
start.setTime(QTime(15, 0, 0));
|
PermitType(PERMIT_TYPE::SHORT_TERM_PARKING_PKW),
|
||||||
productStart = productEnd = QDateTime();
|
paymentOptionIndex, s);
|
||||||
price = compute_product_price(&cfg, PERMIT_TYPE::DAY_TICKET, start, &productStart, &productEnd);
|
|
||||||
qCritical() << QString("line=%1 price (%2-%3) :")
|
qCritical() << "minimal parking price" << minimal_parking_price;
|
||||||
.arg(__LINE__)
|
|
||||||
.arg(productStart.time().toString(Qt::ISODate))
|
for (int i = 0; i < 8; ++i) {
|
||||||
.arg(productEnd.time().toString(Qt::ISODate))
|
calcState = compute_duration_for_parking_ticket(&cfg, s,
|
||||||
<< price;
|
(double)minimal_parking_price + i*800,
|
||||||
|
end, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING_PKW));
|
||||||
price = get_minimal_parkingprice(&cfg, PERMIT_TYPE::DAY_TICKET, 0, start);
|
qCritical() << "RUN" << i << end.toString(Qt::ISODate) << calcState.toString();
|
||||||
qCritical() << QString("line=%1 get_minimal_parkingprice:").arg(__LINE__) << price;
|
}
|
||||||
|
|
||||||
start.setTime(QTime(16, 0, 0));
|
s.setTime(QTime(15, 0, 0));
|
||||||
productStart = productEnd = QDateTime();
|
|
||||||
price = compute_product_price(&cfg, PERMIT_TYPE::DAY_TICKET, start, &productStart, &productEnd);
|
minimal_parking_price = get_minimal_parkingprice(&cfg,
|
||||||
qCritical() << QString("line=%1 price (%2-%3) :")
|
PermitType(PERMIT_TYPE::SHORT_TERM_PARKING_PKW),
|
||||||
.arg(__LINE__)
|
paymentOptionIndex, s);
|
||||||
.arg(productStart.time().toString(Qt::ISODate))
|
|
||||||
.arg(productEnd.time().toString(Qt::ISODate))
|
qCritical() << "minimal parking price" << minimal_parking_price;
|
||||||
<< price;
|
|
||||||
|
for (int i = 0; i < 8; ++i) {
|
||||||
price = get_minimal_parkingprice(&cfg, PERMIT_TYPE::DAY_TICKET, 0, start);
|
calcState = compute_duration_for_parking_ticket(&cfg, s,
|
||||||
qCritical() << QString("line=%1 get_minimal_parkingprice:").arg(__LINE__) << price;
|
(double)minimal_parking_price + i*800,
|
||||||
|
end, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING_PKW));
|
||||||
start.setTime(QTime(17, 0, 0));
|
qCritical() << "RUN" << i << end.toString(Qt::ISODate) << calcState.toString();
|
||||||
productStart = productEnd = QDateTime();
|
|
||||||
price = compute_product_price(&cfg, PERMIT_TYPE::DAY_TICKET, start, &productStart, &productEnd);
|
|
||||||
qCritical() << QString("line=%1 price (%2-%3) :")
|
|
||||||
.arg(__LINE__)
|
|
||||||
.arg(productStart.time().toString(Qt::ISODate))
|
|
||||||
.arg(productEnd.time().toString(Qt::ISODate))
|
|
||||||
<< price;
|
|
||||||
|
|
||||||
//price = get_minimal_parkingprice(&cfg, PERMIT_TYPE::DAY_TICKET, 0, start);
|
|
||||||
//qCritical() << QString("line=%1 get_minimal_parkingprice:").arg(__LINE__) << price;
|
|
||||||
|
|
||||||
//price = get_minimal_parkingprice(&cfg, PERMIT_TYPE::DAY_TICKET);
|
|
||||||
//qCritical() << QString("line=%1 get_minimal_parkingprice:").arg(__LINE__) << price;
|
|
||||||
|
|
||||||
#else
|
|
||||||
for (int h = 0; h < 24; ++h) {
|
|
||||||
start.setTime(QTime(h, 0, 0));
|
|
||||||
productStart = productEnd = QDateTime();
|
|
||||||
price = compute_product_price(&cfg, PERMIT_TYPE::DAY_TICKET, start, &productStart, &productEnd);
|
|
||||||
qCritical() << QString("line=%1 %2 price (%3-%4) :")
|
|
||||||
.arg(__LINE__)
|
|
||||||
.arg(start.time().toString(Qt::ISODate))
|
|
||||||
.arg(productStart.time().toString(Qt::ISODate))
|
|
||||||
.arg(productEnd.time().toString(Qt::ISODate))
|
|
||||||
<< price;
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -30,7 +30,9 @@ SOURCES += main.cpp
|
|||||||
# HEADERS +=
|
# HEADERS +=
|
||||||
|
|
||||||
OTHER_FILES += \
|
OTHER_FILES += \
|
||||||
/home/linux/customer_505/etc/psa_tariff/tariff01.json
|
/opt/ptu5/opt/customer_502/etc/psa_tariff/tariff01.json \
|
||||||
|
/opt/ptu5/opt/customer_502/etc/psa_tariff/tariff02.json \
|
||||||
|
/opt/ptu5/opt/customer_502/etc/psa_tariff/tariff03.json
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user