Removed some debug output for testing

This commit is contained in:
Gerhard Hoffmann 2024-07-24 12:37:29 +02:00
parent 2a3ff30e66
commit b4b2e27fe3

View File

@ -31,6 +31,8 @@ QDateTime Calculator::GetDailyTicketDuration(Configuration* cfg, const QDateTime
return QDateTime();
}
// qCritical() << __func__ << start_datetime.toString(Qt::ISODate);
double day_price = 0.0f;
int current_special_day_id = -1;
bool is_special_day = Utilities::CheckSpecialDay(cfg, start_datetime.toString(Qt::ISODate).toStdString().c_str(), &current_special_day_id, &day_price);
@ -902,8 +904,13 @@ CalcState Calculator::isParkingAllowedForWeekDay(Configuration const *cfg,
QTime const &startTime = start.time();
// qCritical() << DBG_HEADER << "START TIME" << startTime.toString(Qt::ISODate);
if (startTime >= from && startTime <= until) {
QDateTime const end = start.addSecs(netto_parking_time*60);
//qCritical() << DBG_HEADER << "END-DATE-TIME" << end.toString(Qt::ISODate);
QTime const endTime = end.time();
if (endTime <= until && start.date().dayOfWeek() == end.date().dayOfWeek()) {
qCritical() << DBG_HEADER;
@ -954,28 +961,29 @@ CalcState Calculator::isParkingAllowedForWeekDay(Configuration const *cfg,
ATBTimeRange s = cfg->TimeRange.find(pop_carry_over_start_time_range)->second;
ATBTimeRange e = cfg->TimeRange.find(pop_carry_over_end_time_range)->second;
// qCritical() << DBG_HEADER
// << "startTime" << startTime.toString(Qt::ISODate);
//qCritical() << DBG_HEADER << "startTime" << startTime.toString(Qt::ISODate);
//qCritical() << DBG_HEADER << "s: time range from" << s.getTimeFrom().toString(Qt::ISODate);
//qCritical() << DBG_HEADER << "s: time range until" << s.getTimeUntil().toString(Qt::ISODate);
if (startTime >= s.getTimeFrom() && startTime <= s.getTimeUntil()) {
QDateTime sd = start;
sd.setTime(s.getTimeUntil());
// qCritical() << DBG_HEADER << "jumpFrom" << sd.toString(Qt::ISODate);
//qCritical() << DBG_HEADER << "jumpFrom" << sd.toString(Qt::ISODate);
QDateTime ed = start.addDays(1);
ed.setTime(e.getTimeFrom());
// qCritical() << DBG_HEADER << "to" << ed.toString(Qt::ISODate);
//qCritical() << DBG_HEADER << "to" << ed.toString(Qt::ISODate);
int const jumpSecs = sd.secsTo(ed);
// qCritical() << DBG_HEADER << "jumpSecs" << jumpSecs;
//qCritical() << DBG_HEADER << "jumpSecs" << jumpSecs;
QDateTime const end = start.addSecs(netto_parking_time*60 + jumpSecs);
// qCritical() << DBG_HEADER << "new end" << end.toString(Qt::ISODate);
//qCritical() << DBG_HEADER << "new end" << end.toString(Qt::ISODate);
if (end.time() <= e.getTimeUntil()) {
@ -2121,6 +2129,10 @@ QList<int> Calculator::GetPriceSteps(Configuration * /*cfg*/) const {
QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
QDateTime const &s) const {
// TEST
// paymentOptionIndex = 1;
if (DBG_LEVEL >= DBG_DEBUG) {
qCritical() << "(" << __func__ << ":" << __LINE__ << ") paymentOptionIndex:" << paymentOptionIndex;
}
@ -2135,6 +2147,7 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
m_timeSteps[paymentOptionIndex].clear();
} else {
// int diff = paymentOp m_timeSteps.size()
m_timeSteps.push_back(QList<int>());
}
@ -2363,23 +2376,29 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
search->second = duration;
} else
if (duration.pun_interpolation_id == (int)ATBInterpolation::NO_INTERPOLATION) {
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") runtime in minutes (1):" << runtimeInMinutes;
#if 0
qCritical() << "(" << __func__ << ":" << __LINE__ << ") runtime in minutes (1):" << runtimeInMinutes;
QDateTime s = start.addSecs(runtimeInMinutes * 60);
int const minutes = s.time().secsTo(carryOverStart) / 60;
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") minutes:" << minutes;
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") s:" << s.toString(Qt::ISODate);
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_id:" << duration.pun_id;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") minutes:" << minutes;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") start:" << start.toString(Qt::ISODate);
qCritical() << "(" << __func__ << ":" << __LINE__ << ") s:" << s.toString(Qt::ISODate);
if (minutes > 0) {
runtimeInMinutes += minutes;
previous.pun_duration += minutes;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") previous:" << previous.pun_duration;
if (!m_timeSteps[paymentOptionIndex].isEmpty()) {
m_timeSteps[paymentOptionIndex].last() += minutes;
}
}
#endif
nextTimeStep = start.addSecs(runtimeInMinutes * 60);
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") next time step:" << nextTimeStep.toString(Qt::ISODate);
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") runtime in minutes (0):" << runtimeInMinutes;
@ -2410,6 +2429,10 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
}
duration.pun_duration = runtimeInMinutes;
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_id:" << duration.pun_id;
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_duration:" << duration.pun_duration;
m_timeSteps[paymentOptionIndex] << duration.pun_duration;
search->second = duration;
} else {
@ -2474,6 +2497,8 @@ uint32_t Calculator::GetPriceForTimeStep(Configuration *cfg, int timeStep, int p
uint32_t price = 0;
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") timeStep" << timeStep;
for (auto[itr, rangeEnd] = cfg->PaymentRate.equal_range(pop_id); itr != rangeEnd; ++itr)
{
int const payment_unit_id = itr->second.pra_payment_unit_id;
@ -2488,6 +2513,10 @@ uint32_t Calculator::GetPriceForTimeStep(Configuration *cfg, int timeStep, int p
price = (uint32_t)(itr->second.pra_price);
}
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") price" << price;
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_id" << cfg->Duration.find(payment_unit_id)->second.pun_id;
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_duration" << pun_duration;
if (timeStep == pun_duration) {
return price;
}