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