Minor: add debug ouput (and commnt it out)

This commit is contained in:
Gerhard Hoffmann 2023-12-06 10:51:46 +01:00
parent d7beb3b41b
commit 54e9a0f86d

View File

@ -364,6 +364,9 @@ Ticket Calculator::private_GetCostFromDuration(Configuration const* cfg,
QTime const &lastWorktimeTo = worktime[ranges-1].getTimeUntil();
// qCritical() << "start" << start.toString(Qt::ISODate)
// << "current" << current.toString(Qt::ISODate) << lastWorktimeTo;
// find worktime range to start with
int currentRange = 0;
if (!isSpecialDay) {
@ -386,6 +389,8 @@ Ticket Calculator::private_GetCostFromDuration(Configuration const* cfg,
}
}
// qCritical() << "current" << current.toString(Qt::ISODate);
for (int w = currentRange; w < ranges; ++w, ++totalTimeRanges) {
if (durationMinutes > 0) {
QTime const &worktime_from = worktime[w].getTimeFrom();
@ -416,12 +421,13 @@ Ticket Calculator::private_GetCostFromDuration(Configuration const* cfg,
return Ticket();
}
} else {
qDebug() << "* PREPAID MODE ACTIVE *";
//qDebug() << "* PREPAID MODE ACTIVE *";
//qCritical() << "current" << current.toString(Qt::ISODate) << worktime_from << lastWorktimeTo;
if (current.time() < worktime_from) {
current.setTime(worktime_from);
end = current;
} else if(current.time() > lastWorktimeTo) {
qDebug() << " *** PREPAID *** Current time is past the time range end, searching for next available day";
//qDebug() << " *** PREPAID *** Current time is past the time range end, searching for next available day";
end = current;
current.setTime(QTime());
continue;
@ -442,6 +448,7 @@ Ticket Calculator::private_GetCostFromDuration(Configuration const* cfg,
current.setTime(QTime());
break; // stop while, and continue in outer loop
} else {
//qCritical() << "current" << current.toString(Qt::ISODate) << worktime_to;
if(current.time() < worktime_to) {
// Increment input date minutes for each monetary unit
current = current.addSecs(60);
@ -449,6 +456,7 @@ Ticket Calculator::private_GetCostFromDuration(Configuration const* cfg,
durationMinutes -= 1;
//costFromDuration += price_per_unit;
costFromDuration += price;
//qCritical() << "current" << current.toString(Qt::ISODate);
} else break;
}
} // while(durationMinutes > 0) {