get_minimal_parkingtime():
compute_price_for_parking_ticket(): Minor: changed debug output.
This commit is contained in:
parent
62c52fd580
commit
cbcf8391b3
@ -36,10 +36,11 @@ int CALCULATE_LIBRARY_API get_minimal_parkingtime(Configuration const *cfg,
|
|||||||
int paymentOptionIndex) {
|
int paymentOptionIndex) {
|
||||||
int minTime = 0;
|
int minTime = 0;
|
||||||
|
|
||||||
|
qCritical() << __func__ << __LINE__ << "permit" << PermitType(permitType).toString();
|
||||||
|
|
||||||
paymentOptionIndex = cfg->getPaymentOptionIndex(permitType);
|
paymentOptionIndex = cfg->getPaymentOptionIndex(permitType);
|
||||||
|
|
||||||
qCritical() << __func__ << __LINE__ << "paymentOptionIndex" << paymentOptionIndex;
|
qCritical() << __func__ << __LINE__ << "paymentOptionIndex" << paymentOptionIndex;
|
||||||
qCritical() << __func__ << __LINE__ << "permit" << PermitType(permitType).toString();
|
|
||||||
|
|
||||||
switch(permitType) {
|
switch(permitType) {
|
||||||
case PERMIT_TYPE::SHORT_TERM_PARKING: { // e.g. szeged (customer_281)
|
case PERMIT_TYPE::SHORT_TERM_PARKING: { // e.g. szeged (customer_281)
|
||||||
@ -723,9 +724,14 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
|
|||||||
|
|
||||||
int paymentOptionIndex = tariff->getPaymentOptionIndex(permitType);
|
int paymentOptionIndex = tariff->getPaymentOptionIndex(permitType);
|
||||||
|
|
||||||
|
QList<int> tlist = Calculator::GetInstance().GetTimeSteps(tariff, paymentOptionIndex);
|
||||||
|
//Q_UNUSED(tlist);
|
||||||
|
|
||||||
double minMin = tariff->getPaymentOptions(paymentOptionIndex).pop_min_time;
|
double minMin = tariff->getPaymentOptions(paymentOptionIndex).pop_min_time;
|
||||||
double maxMin = tariff->getPaymentOptions(paymentOptionIndex).pop_max_time;
|
double maxMin = tariff->getPaymentOptions(paymentOptionIndex).pop_max_time;
|
||||||
|
|
||||||
|
// netto_parking_time = minMin;
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
qCritical() << "compute_price_for_parking_ticket() " << endl
|
qCritical() << "compute_price_for_parking_ticket() " << endl
|
||||||
<< " paymentOptionIndex: " << paymentOptionIndex << endl
|
<< " paymentOptionIndex: " << paymentOptionIndex << endl
|
||||||
@ -733,8 +739,8 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
|
|||||||
<< " netto_parking_time: " << netto_parking_time << endl
|
<< " netto_parking_time: " << netto_parking_time << endl
|
||||||
<< " start + netto: " << start_parking_time.addSecs(netto_parking_time * 60) << endl
|
<< " start + netto: " << start_parking_time.addSecs(netto_parking_time * 60) << endl
|
||||||
<< " minMin: " << minMin << endl
|
<< " minMin: " << minMin << endl
|
||||||
<< " maxMin: " << maxMin
|
<< " maxMin: " << maxMin << endl
|
||||||
<< " prepaid: " << prepaid
|
<< " prepaid: " << prepaid << endl
|
||||||
<< " permitType: " << permitType.toString();
|
<< " permitType: " << permitType.toString();
|
||||||
|
|
||||||
if (netto_parking_time < 0) {
|
if (netto_parking_time < 0) {
|
||||||
@ -743,14 +749,17 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
|
|||||||
start_parking_time.toString(Qt::ISODate)));
|
start_parking_time.toString(Qt::ISODate)));
|
||||||
return calcState.set(CalcState::State::NEGATIVE_PARKING_TIME);
|
return calcState.set(CalcState::State::NEGATIVE_PARKING_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (netto_parking_time > maxMin) {
|
if (netto_parking_time > maxMin) {
|
||||||
calcState.setDesc(QString("duration=%1, maxMin=%2").arg(netto_parking_time).arg(maxMin));
|
calcState.setDesc(QString("duration=%1, maxMin=%2").arg(netto_parking_time).arg(maxMin));
|
||||||
return calcState.set(CalcState::State::ABOVE_MAX_PARKING_TIME);
|
return calcState.set(CalcState::State::ABOVE_MAX_PARKING_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (netto_parking_time < minMin) {
|
if (netto_parking_time < minMin) {
|
||||||
calcState.setDesc(QString("duration=%1, minMin=%2").arg(netto_parking_time).arg(minMin));
|
calcState.setDesc(QString("duration=%1, minMin=%2").arg(netto_parking_time).arg(minMin));
|
||||||
return calcState.set(CalcState::State::BELOW_MIN_PARKING_TIME);
|
return calcState.set(CalcState::State::BELOW_MIN_PARKING_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (netto_parking_time == 0) {
|
if (netto_parking_time == 0) {
|
||||||
return calcState.set(CalcState::State::SUCCESS);
|
return calcState.set(CalcState::State::SUCCESS);
|
||||||
}
|
}
|
||||||
@ -768,15 +777,12 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
|
|||||||
return calcState;
|
return calcState;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<int> tlist = Calculator::GetInstance().GetTimeSteps(tariff);
|
|
||||||
Q_UNUSED(tlist);
|
|
||||||
|
|
||||||
// compute cost (price)
|
// compute cost (price)
|
||||||
cost = Calculator::GetInstance().GetCostFromDuration(tariff, start_parking_time, netto_parking_time, paymentOptionIndex);
|
cost = Calculator::GetInstance().GetCostFromDuration(tariff, start_parking_time, netto_parking_time, paymentOptionIndex);
|
||||||
|
|
||||||
int weekDay = start_parking_time.date().dayOfWeek();
|
int weekDay = start_parking_time.date().dayOfWeek();
|
||||||
int pop_carry_over_option_id = tariff->getPaymentOptions(paymentOptionIndex).pop_carry_over_option_id;
|
int pop_carry_over_option_id = tariff->getPaymentOptions(paymentOptionIndex).pop_carry_over_option_id;
|
||||||
qCritical() << __func__ << __LINE__ << "configured carry-over-id" << pop_carry_over_option_id;
|
|
||||||
|
|
||||||
std::optional<ATBPeriodYear> yperiod = Utilities::GetYearPeriodActive(tariff, start_parking_time);
|
std::optional<ATBPeriodYear> yperiod = Utilities::GetYearPeriodActive(tariff, start_parking_time);
|
||||||
if (yperiod.has_value()) {
|
if (yperiod.has_value()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user