tests for schnals
This commit is contained in:
parent
3503306637
commit
1c86e1ac40
@ -643,8 +643,8 @@ int main() {
|
||||
int pop_max_price;
|
||||
int pop_daily_card_price;
|
||||
|
||||
input.open("/home/linux/customer_505/etc/psa_tariff/tariff01.json");
|
||||
//input.open("/opt/ptu5/opt/customer_506/etc/psa_tariff/tariff01.json");
|
||||
//input.open("/home/linux/customer_505/etc/psa_tariff/tariff01.json");
|
||||
input.open("/opt/ptu5/opt/customer_505/etc/psa_tariff/tariff01.json");
|
||||
|
||||
std::stringstream sstr;
|
||||
while(input >> sstr.rdbuf());
|
||||
@ -675,10 +675,12 @@ int main() {
|
||||
//}
|
||||
//return 0;
|
||||
|
||||
QList<int> timeSteps = Calculator::GetInstance().GetTimeSteps(&cfg);
|
||||
qCritical() << "TimeSteps" << timeSteps;
|
||||
//QDateTime start = QDateTime::currentDateTime();
|
||||
//start.setTime(QTime(18, 0, 0));
|
||||
//QList<int> timeSteps = Calculator::GetInstance().GetTimeSteps(&cfg, 0, start);
|
||||
//qCritical() << "TimeSteps" << timeSteps;
|
||||
|
||||
return 0;
|
||||
//return 0;
|
||||
|
||||
CalcState cs;
|
||||
double cost;
|
||||
@ -687,7 +689,7 @@ int main() {
|
||||
|
||||
// for (int day = Qt::Monday; day <= Qt::Sunday; ++day) {
|
||||
for (int day = Qt::Monday; day <= Qt::Monday; ++day) {
|
||||
QDateTime s(QDate(2024, 7, 14 + day), QTime());
|
||||
QDateTime s(QDate(2024, 7, 21 + day), QTime(0, 0, 0));
|
||||
QDateTime end;
|
||||
|
||||
switch (day) {
|
||||
@ -715,66 +717,30 @@ int main() {
|
||||
}
|
||||
|
||||
//for (int minutes = 0; minutes < 1440; ++minutes) {
|
||||
for (int minutes = 480; minutes < 480; minutes += 1) {
|
||||
for (int minutes = 420; minutes <= 420; minutes += 1) {
|
||||
QDateTime start = s.addSecs(minutes * 60);
|
||||
|
||||
// qCritical() << "start" << start.toString(Qt::ISODate);
|
||||
qCritical() << "start" << start.toString(Qt::ISODate);
|
||||
|
||||
QDateTime effectiveStart = start;
|
||||
|
||||
// hier sollte man auch testen was passiert, falls man ausserhalb
|
||||
// der verkaufsdaten steht
|
||||
if (start.time() < QTime(8, 0, 0)) {
|
||||
effectiveStart.setTime(QTime(8, 0, 0));
|
||||
if (start.time() < QTime(7, 0, 0)) {
|
||||
effectiveStart.setTime(QTime(7, 0, 0));
|
||||
} else
|
||||
if (start.time() <= QTime(19, 0, 0)) {
|
||||
if (start.time() <= QTime(20, 0, 0)) {
|
||||
effectiveStart = start;
|
||||
} else {
|
||||
effectiveStart = start.addDays(1);
|
||||
effectiveStart.setTime(QTime(8, 0, 0)); // next day
|
||||
effectiveStart.setTime(QTime(7, 0, 0)); // next day
|
||||
}
|
||||
|
||||
for (int i = 10; i <= 10; i += 10) {
|
||||
for (int i = 700; i <= 1400; i += 700) {
|
||||
//for (int i = 2100; i <= 2100; i += 10) {
|
||||
cost = i;
|
||||
|
||||
if ((cs = compute_duration_for_parking_ticket(&cfg, start, cost, end))) { // return value
|
||||
|
||||
|
||||
qCritical() << "start" << start.toString(Qt::ISODate) << "< cost" << cost
|
||||
<< "> end" << end.toString(Qt::ISODate);
|
||||
|
||||
durationInMinutes = pop_min_time;
|
||||
if (i > 0) {
|
||||
durationInMinutes += (i/10) * 4;
|
||||
}
|
||||
offsetInMinutes = 0;
|
||||
|
||||
if (effectiveStart.time() >= QTime(8, 0, 0) && effectiveStart.time() <= QTime(19, 0, 0)) {
|
||||
if (effectiveStart.time().secsTo(QTime(19, 0, 0)) < (durationInMinutes * 60)) {
|
||||
offsetInMinutes = 780; // 19:00 -> 8:00
|
||||
}
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
i += 20;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if ((durationInMinutes + offsetInMinutes) == (effectiveStart.secsTo(end) / 60)) {
|
||||
|
||||
if (day == Qt::Monday && minutes >= 480 && minutes <= 1140) {
|
||||
qCritical() << "| start ............................" << start.toString(Qt::ISODate);
|
||||
qCritical() << "| cost ............................." << cost;
|
||||
qCritical() << "| durationInMinutes ................" << durationInMinutes
|
||||
<< "(" << (durationInMinutes - 60) << "+ 60 )";
|
||||
qCritical() << "| offsetInMinutes .................." << offsetInMinutes;
|
||||
qCritical() << "| end .............................." << end.toString(Qt::ISODate) << endl;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!cs) {
|
||||
@ -783,17 +749,16 @@ int main() {
|
||||
// qCritical() << cs.toString();
|
||||
}
|
||||
|
||||
#if 0
|
||||
qCritical() << __LINE__ << "start ............................" << start.toString(Qt::ISODate);
|
||||
qCritical() << __LINE__ << "effectiveStart ..................." << effectiveStart.toString(Qt::ISODate);
|
||||
qCritical() << __LINE__ << "cost ............................." << cost;
|
||||
qCritical() << __LINE__ << "durationInMinutes ................" << durationInMinutes;
|
||||
qCritical() << __LINE__ << "offsetInMinutes .................." << offsetInMinutes;
|
||||
qCritical() << __LINE__ << "effectiveStart.secsTo(end) / 60 .." << effectiveStart.secsTo(end) / 60;
|
||||
qCritical() << __LINE__ << "end .............................." << end.toString(Qt::ISODate) << endl;
|
||||
exit(-1);
|
||||
#endif
|
||||
qCritical() << "start" << start.toString(Qt::ISODate) << "< cost" << cost
|
||||
<< "> end" << end.toString(Qt::ISODate);
|
||||
}
|
||||
for (int i = 60; i <= 60; i += 6) {
|
||||
|
||||
QDateTime end;
|
||||
struct price_t price;
|
||||
cs = compute_price_for_parking_ticket(&cfg, start, 60, end, &price);
|
||||
|
||||
qCritical() << "start" << start.toString(Qt::ISODate) << "end" << end.toString(Qt::ISODate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user