Finished test for Neuhauser/Stockerau/748
This commit is contained in:
parent
f0dca3917c
commit
7492e37e02
132
main/main.cpp
132
main/main.cpp
@ -218,20 +218,128 @@ int main() {
|
|||||||
//QDateTime s(QDate(2024, 5, 29), QTime()); // wednesday
|
//QDateTime s(QDate(2024, 5, 29), QTime()); // wednesday
|
||||||
//QDateTime s(QDate(2024, 5, 30), QTime()); // thursday
|
//QDateTime s(QDate(2024, 5, 30), QTime()); // thursday
|
||||||
|
|
||||||
QDateTime s(QDate(2024, 5, 31), QTime()); // friday
|
|
||||||
QDateTime end;
|
|
||||||
QDateTime start = s.addSecs(7*60*60);
|
|
||||||
|
|
||||||
CalcState cs;
|
CalcState cs;
|
||||||
for (int i = 600; i <= 600; i += 10) {
|
double const x = 30.0/7.0;
|
||||||
// for (int i = 70; i <= 70; i += 10) {
|
double cost;
|
||||||
double cost = i;
|
int durationInMinutes;
|
||||||
if ((cs = compute_duration_for_parking_ticket(&cfg, start, cost, end))) { // return value
|
int offsetInMinutes = 0;
|
||||||
qCritical() << "start" << start.toString(Qt::ISODate);
|
|
||||||
qCritical() << " cost" << cost;
|
for (int day = Qt::Monday; day <= Qt::Sunday; ++day) {
|
||||||
qCritical() << " end" << end.toString(Qt::ISODate) << endl;
|
QDateTime s(QDate(2024, 5, 19 + day), QTime()); // 20: (whit) monday,..., 26: sunday
|
||||||
|
QDateTime end;
|
||||||
|
|
||||||
|
for (int minutes = 0; minutes < 1440; ++minutes) {
|
||||||
|
//for (int minutes = 0; minutes < 1440; ++minutes) {
|
||||||
|
QDateTime start = s.addSecs(minutes * 60);
|
||||||
|
QDateTime effectiveStart = start;
|
||||||
|
|
||||||
|
if (day >= Qt::Monday && day <= Qt::Friday) {
|
||||||
|
if (start.time() < QTime(8,0,0)) {
|
||||||
|
effectiveStart.setTime(QTime(8,0,0));
|
||||||
|
} else
|
||||||
|
if (start.time() <= QTime(12,0,0)) {
|
||||||
|
effectiveStart = start;
|
||||||
|
} else
|
||||||
|
if (start.time() < QTime(13,30,0)) {
|
||||||
|
effectiveStart.setTime(QTime(13,30,0));
|
||||||
|
} else
|
||||||
|
if (start.time() <= QTime(18,0,0)) {
|
||||||
|
effectiveStart = start;
|
||||||
} else {
|
} else {
|
||||||
qCritical() << "ERROR CalcState" << cs.toString();
|
effectiveStart = start.addDays(1);
|
||||||
|
effectiveStart.setTime(QTime(8,0,0)); // saturday
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
if (day == Qt::Saturday) {
|
||||||
|
if (start.time() < QTime(8,0,0)) {
|
||||||
|
effectiveStart.setTime(QTime(8,0,0));
|
||||||
|
} else
|
||||||
|
if (start.time() <= QTime(12,0,0)) {
|
||||||
|
effectiveStart = start;
|
||||||
|
} else {
|
||||||
|
effectiveStart = start.addDays(2);
|
||||||
|
effectiveStart.setTime(QTime(8,0,0)); // monday
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
if (day == Qt::Sunday) {
|
||||||
|
effectiveStart = start.addDays(1);
|
||||||
|
effectiveStart.setTime(QTime(8,0,0)); // monday
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 70; i <= 600; i += 10) {
|
||||||
|
// for (int i = 70; i <= 70; i += 10) {
|
||||||
|
cost = i;
|
||||||
|
if ((cs = compute_duration_for_parking_ticket(&cfg, start, cost, end))) { // return value
|
||||||
|
durationInMinutes = truncf(x * (i/10));
|
||||||
|
offsetInMinutes = 0;
|
||||||
|
if (day >= Qt::Monday && day <= Qt::Friday) {
|
||||||
|
if (effectiveStart.time() >= QTime(8, 0, 0) && effectiveStart.time() <= QTime(12, 0, 0)) {
|
||||||
|
if (effectiveStart.date().dayOfWeek() == start.date().dayOfWeek()) {
|
||||||
|
if (effectiveStart.time().addSecs(durationInMinutes * 60) > QTime(12, 0, 0)) {
|
||||||
|
offsetInMinutes = 90; // 12:00 - 13:30
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
offsetInMinutes = 14 * 60; // 18:00 -> next day, 8:00
|
||||||
|
if (effectiveStart.time().addSecs(durationInMinutes * 60) <= QTime(12, 0, 0)) {
|
||||||
|
offsetInMinutes = 0;
|
||||||
|
} else {
|
||||||
|
if (effectiveStart.date().dayOfWeek() == Qt::Saturday) {
|
||||||
|
offsetInMinutes = (12 + 24 + 8) * 60;
|
||||||
|
} else {
|
||||||
|
offsetInMinutes = 90;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
if (effectiveStart.time() >= QTime(13, 30, 0)) {
|
||||||
|
if (effectiveStart.time().addSecs(durationInMinutes * 60) > QTime(18, 0, 0)) {
|
||||||
|
offsetInMinutes = 14 * 60; // 18:00 -> next day, 8:00
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
if (day == Qt::Saturday) {
|
||||||
|
if (effectiveStart.time() >= QTime(8, 0, 0) && effectiveStart.time() <= QTime(12, 0, 0)) {
|
||||||
|
if (effectiveStart.date().dayOfWeek() == start.date().dayOfWeek()) {
|
||||||
|
if (effectiveStart.time().addSecs(durationInMinutes * 60) > QTime(12, 0, 0)) {
|
||||||
|
offsetInMinutes = (12 + 24 + 8) * 60; // monday, 8:00
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
offsetInMinutes = (12 + 24 + 8) * 60; // monday, 8:00
|
||||||
|
if (effectiveStart.time().addSecs(durationInMinutes * 60) <= QTime(12, 0, 0)) {
|
||||||
|
offsetInMinutes = 0;
|
||||||
|
} else {
|
||||||
|
offsetInMinutes = 90;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
if (day == Qt::Sunday) {
|
||||||
|
if (effectiveStart.time() >= QTime(8, 0, 0) && effectiveStart.time() <= QTime(12, 0, 0)) {
|
||||||
|
if (effectiveStart.time().addSecs(durationInMinutes * 60) > QTime(12, 0, 0)) {
|
||||||
|
offsetInMinutes = 90;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((durationInMinutes + offsetInMinutes) == (effectiveStart.secsTo(end) / 60)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cs) {
|
||||||
|
qCritical() << "ERROR CalcState" << cs.toString() << endl;
|
||||||
|
} else {
|
||||||
|
qCritical() << "SUCCESS";
|
||||||
|
}
|
||||||
|
qCritical() << "start ............................" << start.toString(Qt::ISODate);
|
||||||
|
qCritical() << "effectiveStart ..................." << effectiveStart.toString(Qt::ISODate);
|
||||||
|
qCritical() << "cost ............................." << cost;
|
||||||
|
qCritical() << "durationMinutes .................." << durationInMinutes;
|
||||||
|
qCritical() << "offsetInMinutes .................." << offsetInMinutes;
|
||||||
|
qCritical() << "effectiveStart.secsTo(end) / 60 .." << effectiveStart.secsTo(end) / 60;
|
||||||
|
qCritical() << "end .............................." << end.toString(Qt::ISODate) << endl;
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user