compute_price_for_parking_ticket():
Fetch prepaid-option-id (possibly recalculating it depending on year-period), and fetch associated prepaid-options.
This commit is contained in:
parent
d21f69cb9b
commit
5dbd3645c6
@ -805,20 +805,22 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
|
||||
|
||||
int weekDay = start_parking_time.date().dayOfWeek();
|
||||
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;
|
||||
int pop_prepaid_option_id = tariff->getPaymentOptions(paymentOptionIndex).pop_prepaid_option_id;
|
||||
|
||||
std::optional<ATBPeriodYear> yperiod = Utilities::GetYearPeriodActive(tariff, start_parking_time);
|
||||
if (yperiod.has_value()) {
|
||||
ATBPeriodYear const &period = yperiod.value();
|
||||
pop_carry_over_option_id = period.pye_id;
|
||||
qCritical() << __func__ << __LINE__ << "re-computed carry-over-id" << pop_carry_over_option_id;
|
||||
pop_prepaid_option_id = period.pye_id;
|
||||
qCritical() << __func__ << ":" << __LINE__ << "re-computed carry-over-id" << pop_carry_over_option_id;
|
||||
qCritical() << __func__ << ":" << __LINE__ << " re-computed prepaid-id" << pop_prepaid_option_id;
|
||||
}
|
||||
|
||||
QTime const carryOverStart = tariff->TariffCarryOverOptions.find(pop_carry_over_option_id)->second.carryover[weekDay].static_start;
|
||||
int const carryOverDuration = tariff->TariffCarryOverOptions.find(pop_carry_over_option_id)->second.carryover[weekDay].duration;
|
||||
QTime carryOverStart = tariff->TariffCarryOverOptions.find(pop_carry_over_option_id)->second.carryover[weekDay].static_start;
|
||||
int carryOverDuration = tariff->TariffCarryOverOptions.find(pop_carry_over_option_id)->second.carryover[weekDay].duration;
|
||||
|
||||
qCritical() << __func__ << __LINE__ << "carryOverStart" << carryOverStart.toString(Qt::ISODate);
|
||||
qCritical() << __func__ << __LINE__ << "carryOverDuration" << carryOverDuration;
|
||||
qCritical() << __func__ << ":" << __LINE__ << " carryOverStart" << carryOverStart.toString(Qt::ISODate);
|
||||
qCritical() << __func__ << ":" << __LINE__ << "carryOverDuration" << carryOverDuration;
|
||||
|
||||
// handle prepaid option
|
||||
QDateTime effectiveStartTime(start_parking_time);
|
||||
@ -827,13 +829,17 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
|
||||
if (prepaidOption.has_value()) {
|
||||
ATBPrepaid const &p = prepaidOption.value();
|
||||
if (p.never) {
|
||||
qCritical() << __func__ << __LINE__ << "prepaid: no";
|
||||
qCritical() << __func__ << ":" << __LINE__ << "prepaid: no";
|
||||
} else {
|
||||
if (start_parking_time.time() < p.static_end) { // static_end: e.g. 08:00:00
|
||||
effectiveStartTime.setTime(p.static_end);
|
||||
qCritical() << __func__ << ":" << __LINE__ << " prepaidStart" << p.prepaid[weekDay].static_start.toString(Qt::ISODate);
|
||||
qCritical() << __func__ << ":" << __LINE__ << " prepaidEnd" << p.prepaid[weekDay].static_end.toString(Qt::ISODate);
|
||||
qCritical() << __func__ << ":" << __LINE__ << "prepaid duration" << p.prepaid[weekDay].duration;
|
||||
|
||||
if (start_parking_time.time() < p.prepaid[weekDay].static_end) { // static_end: e.g. 08:00:00
|
||||
effectiveStartTime.setTime(p.prepaid[weekDay].static_end);
|
||||
} else
|
||||
if (start_parking_time.time() > p.static_start) { // static_start: e.g. 22:00:00
|
||||
effectiveStartTime.setTime(p.static_start);
|
||||
if (start_parking_time.time() > p.prepaid[weekDay].static_start) { // static_start: e.g. 22:00:00
|
||||
effectiveStartTime.setTime(p.prepaid[weekDay].static_start);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user