Compare commits
No commits in common. "493d94aaa1c1dc5f3b3f7d690a8c83921aea45ae" and "abbbd06f9322fecd45155da7aae03de6275924c0" have entirely different histories.
493d94aaa1
...
abbbd06f93
@ -181,13 +181,6 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
|
|||||||
int durationMinutes = Utilities::getMaximalParkingTime(cfg, paymentMethodId);
|
int durationMinutes = Utilities::getMaximalParkingTime(cfg, paymentMethodId);
|
||||||
int durationMinutesBrutto = 0;
|
int durationMinutesBrutto = 0;
|
||||||
|
|
||||||
#ifdef _DEBUG_
|
|
||||||
#undef _DEBUG_
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//#define _DEBUG_ 1
|
|
||||||
#define _DEBUG_ 0
|
|
||||||
|
|
||||||
QDateTime current = start;
|
QDateTime current = start;
|
||||||
|
|
||||||
int days = 7;
|
int days = 7;
|
||||||
@ -236,340 +229,139 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
|
|||||||
uint price = 0;
|
uint price = 0;
|
||||||
|
|
||||||
if (carryOverNotSet) {
|
if (carryOverNotSet) {
|
||||||
|
int range = 0;
|
||||||
int minsToCarryOver = 0; // from one work-time to the other on the same day
|
int minsToCarryOver = 0; // from one work-time to the other on the same day
|
||||||
int minsUsed = 0;
|
int minsUsed = 0;
|
||||||
QDateTime lastCurrent = QDateTime();
|
QDateTime lastCurrent = QDateTime();
|
||||||
|
|
||||||
QVector<ATBWeekDaysWorktime> weekDayWorkTimeRanges;
|
|
||||||
|
|
||||||
using WTIterator = std::multimap<int, ATBWeekDaysWorktime>::const_iterator;
|
|
||||||
std::pair<WTIterator, WTIterator> p = cfg->WeekDaysWorktime.equal_range(weekdayId);
|
|
||||||
|
|
||||||
for (WTIterator itr = p.first; itr != p.second; ++itr) {
|
|
||||||
weekDayWorkTimeRanges.append(itr->second); // working with vector is easier
|
|
||||||
}
|
|
||||||
|
|
||||||
int weekDayWorkTimeIndex = 0;
|
|
||||||
bool moveToNextTimeRange = false;
|
|
||||||
|
|
||||||
// time ranges for Neuhauser-Kirchdorf (743): 30, 5, 5, ... 5
|
|
||||||
auto timeRangeIt = cfg->TimeRange.cbegin();
|
auto timeRangeIt = cfg->TimeRange.cbegin();
|
||||||
while (timeRangeIt != cfg->TimeRange.cend()) { // ; ++timeRangeIt) {
|
for (; timeRangeIt != cfg->TimeRange.cend(); ++timeRangeIt) {
|
||||||
|
using WTIterator = std::multimap<int, ATBWeekDaysWorktime>::const_iterator;
|
||||||
|
std::pair<WTIterator, WTIterator> p = cfg->WeekDaysWorktime.equal_range(weekdayId);
|
||||||
|
|
||||||
if (weekDayWorkTimeIndex >= weekDayWorkTimeRanges.size()) {
|
for (WTIterator itr = p.first; itr != p.second; ++itr) {
|
||||||
|
++range;
|
||||||
|
|
||||||
#if _DEBUG_==1
|
QTime const &from = Utilities::WeekDaysWorkTimeFrom(itr);
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
QTime const &to = Utilities::WeekDaysWorkTimeUntil(itr);
|
||||||
<< "weekDayWorkTimeIndex" << weekDayWorkTimeIndex
|
|
||||||
<< "weekDayWorkTimeRanges.size()" << weekDayWorkTimeRanges.size()
|
|
||||||
<< "price" << price;
|
|
||||||
#endif
|
|
||||||
end_datetime = current;
|
|
||||||
return end_datetime.toString(Qt::ISODate).toStdString();
|
|
||||||
}
|
|
||||||
|
|
||||||
QTime const &from = QTime::fromString(weekDayWorkTimeRanges[weekDayWorkTimeIndex].pwd_time_from.c_str(), Qt::ISODate);
|
Q_ASSERT_X(from < to, __func__, "MISCONFIGURED WORK-TIMES");
|
||||||
QTime const &to = QTime::fromString(weekDayWorkTimeRanges[weekDayWorkTimeIndex].pwd_time_to.c_str(), Qt::ISODate);
|
|
||||||
|
|
||||||
#if _DEBUG_==1
|
if (current.time() >= to) {
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
continue; // try to use next available work-time
|
||||||
<< "current" << current.toString(Qt::ISODate)
|
} else
|
||||||
<< "from" << from.toString(Qt::ISODate)
|
if (current.time() <= from) {
|
||||||
<< "to" << to.toString(Qt::ISODate);
|
if (prepaid) {
|
||||||
#endif
|
lastCurrent = current;
|
||||||
|
current.setTime(from); // move current forward (range==1),
|
||||||
|
// as prepaid is set
|
||||||
|
uint const minutesMoved = lastCurrent.secsTo(current) / 60;
|
||||||
|
durationMinutesBrutto += minutesMoved;
|
||||||
|
|
||||||
Q_ASSERT_X(from < to, __func__, "MISCONFIGURED WORK-TIMES");
|
if (range == 1) {
|
||||||
|
start_datetime = current;
|
||||||
if (current.time() >= to) {
|
}
|
||||||
++weekDayWorkTimeIndex;
|
|
||||||
|
|
||||||
#if _DEBUG_==1
|
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
|
||||||
<< "try to use next available work-time with"
|
|
||||||
<< "weekDayWorkTimeIndex" << weekDayWorkTimeIndex
|
|
||||||
<< "price" << price;
|
|
||||||
#endif
|
|
||||||
// time range is not affected
|
|
||||||
continue;
|
|
||||||
} else
|
|
||||||
if (current.time() <= from) {
|
|
||||||
if (prepaid) {
|
|
||||||
lastCurrent = current;
|
|
||||||
current.setTime(from); // move current forward (range==1),
|
|
||||||
// as prepaid is set
|
|
||||||
uint const minutesMoved = lastCurrent.secsTo(current) / 60;
|
|
||||||
durationMinutesBrutto += minutesMoved;
|
|
||||||
|
|
||||||
#if _DEBUG_==1
|
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
|
||||||
<< "lastCurrent" << lastCurrent.toString(Qt::ISODate)
|
|
||||||
<< "current" << current.toString(Qt::ISODate)
|
|
||||||
<< "minutesMoved" << minutesMoved
|
|
||||||
<< "durationMinutesBrutto" << durationMinutesBrutto;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (weekDayWorkTimeIndex == 0) {
|
|
||||||
start_datetime = current;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ATBTimeRange timeRange = timeRangeIt->second;
|
while (timeRangeIt != cfg->TimeRange.cend()) {
|
||||||
|
ATBTimeRange timeRange = timeRangeIt->second;
|
||||||
|
|
||||||
timeRange.computeQTimes(current.time());
|
timeRange.computeQTimes(current.time());
|
||||||
|
|
||||||
int duration = timeRange.time_range_to_in_minutes_from_start -
|
int duration = timeRange.time_range_to_in_minutes_from_start -
|
||||||
timeRange.time_range_from_in_minutes_from_start;
|
timeRange.time_range_from_in_minutes_from_start;
|
||||||
|
|
||||||
#if _DEBUG_==1
|
if (minsUsed > 0) {
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
duration -= minsUsed;
|
||||||
<< "current" << current.toString(Qt::ISODate)
|
minsUsed = 0;
|
||||||
<< "duration" << duration
|
}
|
||||||
<< "minsUsed" << minsUsed
|
|
||||||
<< "minsToCarryOver" << minsToCarryOver
|
|
||||||
<< "weekDayWorkTimeIndex" << weekDayWorkTimeIndex
|
|
||||||
<< "price" << price;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (minsToCarryOver > 0) { // the price for this time range
|
if (current.addSecs(duration * 60).time() <= to) {
|
||||||
// has been is paid already
|
if (minsToCarryOver > 0) { // the price for this time range
|
||||||
Q_ASSERT_X(weekDayWorkTimeIndex > 0, __func__, "WRONG-WORK-TIME");
|
// has been is paid already
|
||||||
|
durationMinutes -= duration;
|
||||||
|
durationMinutesNetto += duration;
|
||||||
|
durationMinutesBrutto += duration;
|
||||||
|
current = current.addSecs(duration*60);
|
||||||
|
minsToCarryOver = 0;
|
||||||
|
} else {
|
||||||
|
for(const auto &x: cfg->PaymentRate) {
|
||||||
|
ATBPaymentRate const rate = x.second;
|
||||||
|
if (rate.pra_payment_unit_id == timeRange.time_range_payment_type_id) {
|
||||||
|
price += (uint)rate.pra_price;
|
||||||
|
|
||||||
current = current.addSecs(minsToCarryOver*60);
|
if (price >= maxParkingPrice) {
|
||||||
|
price = maxParkingPrice;
|
||||||
|
}
|
||||||
|
|
||||||
durationMinutes -= minsToCarryOver;
|
durationMinutes -= duration;
|
||||||
durationMinutesNetto += minsToCarryOver;
|
durationMinutesNetto += duration;
|
||||||
durationMinutesBrutto += minsToCarryOver;
|
durationMinutesBrutto += duration;
|
||||||
|
|
||||||
minsToCarryOver = 0;
|
current = current.addSecs(duration * 60);
|
||||||
|
|
||||||
#if _DEBUG_==1
|
if (price >= cost) {
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
end_datetime = current;
|
||||||
<< "current" << current.toString(Qt::ISODate)
|
return end_datetime.toString(Qt::ISODate).toStdString();
|
||||||
<< "duration" << duration
|
}
|
||||||
<< "durationMinutes" << durationMinutes
|
|
||||||
<< "durationMinutesNetto" << durationMinutesNetto
|
|
||||||
<< "durationMinutesBrutto" << durationMinutesBrutto
|
|
||||||
<< "price" << price;
|
|
||||||
#endif
|
|
||||||
if (price >= cost) {
|
|
||||||
end_datetime = current;
|
|
||||||
|
|
||||||
#if _DEBUG_==1
|
break;
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
}
|
||||||
<< "end_datetime" << end_datetime.toString(Qt::ISODate)
|
}
|
||||||
<< "price" << price;
|
|
||||||
#endif
|
|
||||||
return end_datetime.toString(Qt::ISODate).toStdString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (current.addSecs(duration * 60).time() <= to) {
|
|
||||||
|
|
||||||
#if _DEBUG_==1
|
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
|
||||||
<< "current" << current.toString(Qt::ISODate)
|
|
||||||
<< "current.addSecs(" << duration * 60 << ")" << current.addSecs(duration*60).time().toString(Qt::ISODate)
|
|
||||||
<< "duration" << duration
|
|
||||||
<< "to" << to.toString(Qt::ISODate)
|
|
||||||
<< "minsUsed" << minsUsed
|
|
||||||
<< "minsToCarryOver" << minsToCarryOver
|
|
||||||
<< "weekDayWorkTimeIndex" << weekDayWorkTimeIndex
|
|
||||||
<< "durationMinutes" << durationMinutes;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
moveToNextTimeRange = false;
|
|
||||||
for(const auto &x: cfg->PaymentRate) {
|
|
||||||
ATBPaymentRate const rate = x.second;
|
|
||||||
if (rate.pra_payment_unit_id == timeRange.time_range_payment_type_id) {
|
|
||||||
price += (uint)rate.pra_price;
|
|
||||||
|
|
||||||
if (price >= maxParkingPrice) {
|
|
||||||
price = maxParkingPrice;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
durationMinutes -= duration;
|
if (durationMinutes <= 0) {
|
||||||
durationMinutesNetto += duration;
|
|
||||||
durationMinutesBrutto += duration;
|
|
||||||
|
|
||||||
current = current.addSecs(duration * 60);
|
|
||||||
|
|
||||||
if (price >= cost) {
|
|
||||||
end_datetime = current;
|
end_datetime = current;
|
||||||
#if _DEBUG_==1
|
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
|
||||||
<< "end_datetime" << end_datetime.toString(Qt::ISODate)
|
|
||||||
<< "price" << price;
|
|
||||||
#endif
|
|
||||||
return end_datetime.toString(Qt::ISODate).toStdString();
|
return end_datetime.toString(Qt::ISODate).toStdString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// price has been updated; use next time range
|
++timeRangeIt;
|
||||||
moveToNextTimeRange = true;
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
lastCurrent = current;
|
||||||
|
current.setTime(to);
|
||||||
|
minsUsed = lastCurrent.secsTo(current) / 60;
|
||||||
|
|
||||||
|
// mod duration: possibly discard some minutes in
|
||||||
|
// the next time-range
|
||||||
|
if (durationMinutes >= minsUsed) {
|
||||||
|
minsToCarryOver = durationMinutes - minsUsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
durationMinutes -= minsUsed;
|
||||||
|
durationMinutesNetto += minsUsed;
|
||||||
|
durationMinutesBrutto += minsUsed;
|
||||||
|
|
||||||
|
if (minsUsed > 0) {
|
||||||
|
for(const auto &x: cfg->PaymentRate) {
|
||||||
|
ATBPaymentRate const rate = x.second;
|
||||||
|
if (rate.pra_payment_unit_id == timeRange.time_range_payment_type_id) {
|
||||||
|
price += (uint)rate.pra_price;
|
||||||
|
|
||||||
|
if (price >= maxParkingPrice) {
|
||||||
|
price = maxParkingPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (price >= cost) {
|
||||||
|
end_datetime = current;
|
||||||
|
// return end_datetime.toString(Qt::ISODate).toStdString();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if _DEBUG_==1
|
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
|
||||||
<< "current" << current.toString(Qt::ISODate)
|
|
||||||
<< "duration" << duration
|
|
||||||
<< "to" << to.toString(Qt::ISODate)
|
|
||||||
<< "price" << price
|
|
||||||
<< "minsToCarryOver" << minsToCarryOver
|
|
||||||
<< "weekDayWorkTimeIndex" << weekDayWorkTimeIndex
|
|
||||||
<< "durationMinutes" << durationMinutes
|
|
||||||
<< "durationMinutesNetto" << durationMinutesNetto
|
|
||||||
<< "durationMinutesBrutto" << durationMinutesBrutto;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (price >= cost) {
|
|
||||||
end_datetime = current;
|
|
||||||
|
|
||||||
#if _DEBUG_==1
|
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
|
||||||
<< "end_datetime" << end_datetime.toString(Qt::ISODate)
|
|
||||||
<< "price" << price;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return end_datetime.toString(Qt::ISODate).toStdString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (moveToNextTimeRange) {
|
|
||||||
if (++timeRangeIt != cfg->TimeRange.cend()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// havin a new time range means that we always have a new
|
|
||||||
// work-time-range
|
|
||||||
// ++timeRangeIt;
|
|
||||||
|
|
||||||
} else { // current.addSecs(duration * 60).time() > to
|
|
||||||
|
|
||||||
#if _DEBUG_==1
|
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
|
||||||
<< "current" << current.toString(Qt::ISODate)
|
|
||||||
<< "current.addSecs(" << duration * 60 << ")" << current.addSecs(duration*60).time().toString(Qt::ISODate)
|
|
||||||
<< "duration" << duration
|
|
||||||
<< ", to:" << to.toString(Qt::ISODate);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
lastCurrent = current;
|
|
||||||
current.setTime(to);
|
|
||||||
minsUsed = lastCurrent.secsTo(current) / 60;
|
|
||||||
|
|
||||||
#if _DEBUG_==1
|
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
|
||||||
<< "lastCurrent" << lastCurrent.toString(Qt::ISODate)
|
|
||||||
<< "current" << current.toString(Qt::ISODate)
|
|
||||||
<< "duration" << duration
|
|
||||||
<< "to" << to.toString(Qt::ISODate)
|
|
||||||
<< "minsUsed" << minsUsed
|
|
||||||
<< "minsToCarryOver" << minsToCarryOver
|
|
||||||
<< "weekDayWorkTimeIndex" << weekDayWorkTimeIndex
|
|
||||||
<< "durationMinutes" << durationMinutes;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// mod duration: possibly discard some minutes in
|
|
||||||
// the next time-range
|
|
||||||
if (duration >= minsUsed) {
|
|
||||||
minsToCarryOver = duration - minsUsed;
|
|
||||||
}
|
|
||||||
|
|
||||||
durationMinutes -= minsUsed;
|
|
||||||
durationMinutesNetto += minsUsed;
|
|
||||||
durationMinutesBrutto += minsUsed;
|
|
||||||
|
|
||||||
#if _DEBUG_==1
|
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
|
||||||
<< "lastCurrent" << lastCurrent.toString(Qt::ISODate)
|
|
||||||
<< "current" << current.toString(Qt::ISODate)
|
|
||||||
<< "duration" << duration
|
|
||||||
<< "to" << to.toString(Qt::ISODate)
|
|
||||||
<< "minsUsed" << minsUsed
|
|
||||||
<< "minsToCarryOver" << minsToCarryOver
|
|
||||||
<< "weekDayWorkTimeIndex" << weekDayWorkTimeIndex
|
|
||||||
<< "durationMinutes" << durationMinutes
|
|
||||||
<< "price" << price;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
moveToNextTimeRange = false;
|
|
||||||
|
|
||||||
if (minsUsed > 0) {
|
|
||||||
for(const auto &x: cfg->PaymentRate) {
|
|
||||||
ATBPaymentRate const rate = x.second;
|
|
||||||
if (rate.pra_payment_unit_id == timeRange.time_range_payment_type_id) {
|
|
||||||
price += (uint)rate.pra_price;
|
|
||||||
|
|
||||||
if (price >= maxParkingPrice) {
|
|
||||||
price = maxParkingPrice;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (price >= cost) {
|
|
||||||
end_datetime = current;
|
|
||||||
|
|
||||||
#if _DEBUG_==1
|
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
|
||||||
<< "end_datetime" << end_datetime.toString(Qt::ISODate)
|
|
||||||
<< "price" << price;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// return end_datetime.toString(Qt::ISODate).toStdString();
|
|
||||||
}
|
|
||||||
|
|
||||||
// price has been updated; use next time range
|
|
||||||
moveToNextTimeRange = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if _DEBUG_==1
|
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
|
||||||
<< "current" << current.toString(Qt::ISODate)
|
|
||||||
<< "duration" << duration
|
|
||||||
<< "minsUsed" << minsUsed
|
|
||||||
<< "durationMinutes" << durationMinutes
|
|
||||||
<< "moveToNextTimeRange" << moveToNextTimeRange
|
|
||||||
<< "price" << price;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (moveToNextTimeRange) {
|
|
||||||
if (++timeRangeIt != cfg->TimeRange.cend()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// no valid time range left
|
|
||||||
end_datetime = current;
|
|
||||||
|
|
||||||
#if _DEBUG_==1
|
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
|
||||||
<< "end_datetime" << end_datetime.toString(Qt::ISODate)
|
|
||||||
<< "price" << price;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return end_datetime.toString(Qt::ISODate).toStdString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
end_datetime = start.addSecs(durationMinutesBrutto * 60);
|
end_datetime = start.addSecs(durationMinutesBrutto * 60);
|
||||||
|
|
||||||
#if _DEBUG_==1
|
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
|
||||||
<< "start" << start.toString(Qt::ISODate)
|
|
||||||
<< "end_datetime" << end_datetime.toString(Qt::ISODate)
|
|
||||||
<< "final price" << std::max(price, minParkingPrice);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return end_datetime.toString(Qt::ISODate).toStdString();
|
return end_datetime.toString(Qt::ISODate).toStdString();
|
||||||
} // while (timeRangeIt != cfg->TimeRange.cend()) {
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if _DEBUG_==1
|
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
|
||||||
<< "INVALID END TIME";
|
|
||||||
#endif
|
|
||||||
end_datetime = QDateTime();
|
end_datetime = QDateTime();
|
||||||
return end_datetime.toString(Qt::ISODate).toStdString();
|
return end_datetime.toString(Qt::ISODate).toStdString();
|
||||||
}
|
}
|
||||||
@ -581,7 +373,6 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
|
|||||||
// TODO: im fehlerfall
|
// TODO: im fehlerfall
|
||||||
return t.getValidUntil().toString(Qt::ISODate).toStdString();
|
return t.getValidUntil().toString(Qt::ISODate).toStdString();
|
||||||
}
|
}
|
||||||
#undef _DEBUG_
|
|
||||||
|
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
|
|
||||||
@ -731,9 +522,6 @@ double Calculator::GetCostFromDuration(Configuration* cfg,
|
|||||||
int weekdayIdLast = -1;
|
int weekdayIdLast = -1;
|
||||||
int durationMinutesBrutto = 0;
|
int durationMinutesBrutto = 0;
|
||||||
|
|
||||||
#ifdef _DEBUG_
|
|
||||||
#undef _DEBUG_
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//#define _DEBUG_ 1
|
//#define _DEBUG_ 1
|
||||||
#define _DEBUG_ 0
|
#define _DEBUG_ 0
|
||||||
|
@ -269,20 +269,17 @@ int main() {
|
|||||||
QList<int>::const_iterator step;
|
QList<int>::const_iterator step;
|
||||||
for (step = steps.cbegin(); step != steps.cend(); ++step) {
|
for (step = steps.cbegin(); step != steps.cend(); ++step) {
|
||||||
qCritical() << QString("*** NEXT STEP: %1 ***").arg(*step);
|
qCritical() << QString("*** NEXT STEP: %1 ***").arg(*step);
|
||||||
//for (int offset = 691; offset < 692; ++offset) {
|
for (int offset = 7*60; offset < 18*60; ++offset) {
|
||||||
for (int offset = 480; offset < 1080; ++offset) {
|
|
||||||
//for (int offset = 7*60; offset < (18*60)-90; ++offset) {
|
//for (int offset = 7*60; offset < (18*60)-90; ++offset) {
|
||||||
//for (int offset = (18*60)-90; offset < 18*60; ++offset) {
|
//for (int offset = (18*60)-90; offset < 18*60; ++offset) {
|
||||||
//for (int offset = 1046; offset < 1047; ++offset) {
|
//for (int offset = 1046; offset < 1047; ++offset) {
|
||||||
QDateTime start = s.addSecs(offset * 60);
|
QDateTime start = s.addSecs(offset * 60);
|
||||||
QDateTime const firstStart = start;
|
QDateTime const firstStart = start;
|
||||||
|
|
||||||
//if (*step != 30) continue;
|
//if (*step != 35) continue;
|
||||||
|
|
||||||
double cost = 0;
|
|
||||||
|
|
||||||
if (compute_price_for_parking_ticket(&cfg, start, *step, end, &price)) {
|
if (compute_price_for_parking_ticket(&cfg, start, *step, end, &price)) {
|
||||||
cost = price.netto;
|
double cost = price.netto;
|
||||||
|
|
||||||
qCritical() << "****" << offset << *step << "****";
|
qCritical() << "****" << offset << *step << "****";
|
||||||
qCritical() << " firstStart :" << firstStart.toString(Qt::ISODate);
|
qCritical() << " firstStart :" << firstStart.toString(Qt::ISODate);
|
||||||
@ -427,18 +424,6 @@ int main() {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDateTime end2 = QDateTime();
|
|
||||||
if (compute_duration_for_parking_ticket(&cfg, start, cost, end2)) { // return value
|
|
||||||
qCritical() << "XXXX start" << start.toString(Qt::ISODate)
|
|
||||||
<< "offset" << offset
|
|
||||||
<< "cost" << cost
|
|
||||||
<< "end" << end2.toString(Qt::ISODate);
|
|
||||||
if (end != end2) {
|
|
||||||
qCritical() << "YYYY"
|
|
||||||
<< end.toString(Qt::ISODate)
|
|
||||||
<< end2.toString(Qt::ISODate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user