Only minor changes

This commit is contained in:
Gerhard Hoffmann 2024-01-31 15:08:16 +01:00
parent f87399ed44
commit 9438a535ea

View File

@ -136,9 +136,11 @@ int main() {
QDateTime s(QDate(2023, 11, 30), QTime()); QDateTime s(QDate(2023, 11, 30), QTime());
QDateTime end; QDateTime end;
struct price_t price; struct price_t price;
memset(&price, 0, sizeof(struct price_t));
for (int offset = 480; offset < 1080; ++offset) { for (int offset = 480; offset < 1080; ++offset) {
QDateTime start = s.addSecs(offset * 60); QDateTime start = s.addSecs(offset * 60);
// qCritical() << QString(Calculator::GetInstance().isParkingAllowed(&cfg, start));
CalcState cs = compute_price_for_daily_ticket(&cfg, start, end, CalcState cs = compute_price_for_daily_ticket(&cfg, start, end,
PERMIT_TYPE::DAY_TICKET_ADULT, &price); PERMIT_TYPE::DAY_TICKET_ADULT, &price);
qCritical() << "start=" << start.toString(Qt::ISODate) qCritical() << "start=" << start.toString(Qt::ISODate)
@ -156,13 +158,12 @@ int main() {
#endif #endif
#if NEUHAUSER_LINSINGER_MASCHINENBAU==1 #if NEUHAUSER_LINSINGER_MASCHINENBAU==1
std::ifstream input("/tmp/tariff_linsinger_maschinenbau.json"); std::ifstream input("/opt/ptu5/opt/customer_741/etc/psa_tariff/tariff01.json");
std::stringstream sstr; std::stringstream sstr;
while(input >> sstr.rdbuf()); while(input >> sstr.rdbuf());
std::string json(sstr.str()); std::string json(sstr.str());
Calculator calculator;
Configuration cfg; Configuration cfg;
bool isParsed = cfg.ParseJson(&cfg, json.c_str()); bool isParsed = cfg.ParseJson(&cfg, json.c_str());
@ -181,14 +182,14 @@ int main() {
QDateTime start = s.addSecs(offset * 60); QDateTime start = s.addSecs(offset * 60);
//qCritical() << "start" << start.toString(Qt::ISODate); //qCritical() << "start" << start.toString(Qt::ISODate);
double cost = calculator.GetCostFromDuration(&cfg, 4, start, end, marken[duration], nextDay, prePaid); double cost = Calculator::GetInstance().GetCostFromDuration(&cfg, 4, start, end, marken[duration], nextDay, prePaid);
//qCritical() << ""; //qCritical() << "";
//qCritical() << "start" << start.toString(Qt::ISODate) //qCritical() << "start" << start.toString(Qt::ISODate)
// << "end" << end.toString(Qt::ISODate) // << "end" << end.toString(Qt::ISODate)
// << "duration" << marken[duration] // << "duration" << marken[duration]
// << "cost" << cost; // << "cost" << cost;
std::string d = calculator.GetDurationFromCost(&cfg, 4, start.toString(Qt::ISODate).toStdString().c_str(), cost); std::string d = Calculator::GetInstance().GetDurationFromCost(&cfg, 4, start.toString(Qt::ISODate).toStdString().c_str(), cost);
qCritical() << "start" << start.toString(Qt::ISODate) qCritical() << "start" << start.toString(Qt::ISODate)
<< "cost" << cost << "cost" << cost
<< "until" << d.c_str() << start.secsTo(QDateTime::fromString(d.c_str(), Qt::ISODate)) / 60; << "until" << d.c_str() << start.secsTo(QDateTime::fromString(d.c_str(), Qt::ISODate)) / 60;