Fixed GetDailyTicket(): use pop_id as key to find payment rate.
This commit is contained in:
parent
d2a85532ce
commit
868df3dd32
@ -862,12 +862,20 @@ Calculator::GetDailyTicketPrice(Configuration* cfg,
|
||||
for (QVector<ATBDailyTicket>::size_type i=0; i<tickets.size(); ++i) {
|
||||
if (tickets[i].daily_ticket_clearance_customer_ids.contains(c.value().cust_id)) {
|
||||
int priceId = tickets[i].daily_ticket_price_id;
|
||||
std::optional<QVector<ATBPaymentRate>> const &paymentRates = cfg->getPaymentRateForKey(priceId);
|
||||
QVector<ATBPaymentOption> const &paymentOptions = cfg->getAllPaymentOptions();
|
||||
for (QVector<ATBPaymentOption>::size_type j=0; j < paymentOptions.size(); ++j) {
|
||||
int const pop_id = paymentOptions.at(j).pop_id;
|
||||
std::optional<QVector<ATBPaymentRate>> const &paymentRates = cfg->getPaymentRateForKey(pop_id);
|
||||
if (paymentRates) {
|
||||
QVector<ATBPaymentRate> const &pr = paymentRates.value();
|
||||
if (pr.size() > 0) {
|
||||
price.netto = pr.at(0).pra_price;
|
||||
value.value_or(price);
|
||||
for (QVector<ATBPaymentRate>::size_type k=0; k < pr.size(); ++k) {
|
||||
if (pr.at(k).pra_payment_option_id == pop_id) {
|
||||
if (priceId == pr.at(k).pra_payment_unit_id) {
|
||||
price.netto = pr.at(k).pra_price;
|
||||
value = value.value_or(price);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -880,12 +888,20 @@ Calculator::GetDailyTicketPrice(Configuration* cfg,
|
||||
for (QVector<ATBDailyTicket>::size_type i=0; i<tickets.size(); ++i) {
|
||||
if (tickets[i].daily_ticket_clearance_customer_ids.contains(c.value().cust_id)) {
|
||||
int priceId = tickets[i].daily_ticket_price_id;
|
||||
std::optional<QVector<ATBPaymentRate>> const &paymentRates = cfg->getPaymentRateForKey(priceId);
|
||||
QVector<ATBPaymentOption> const &paymentOptions = cfg->getAllPaymentOptions();
|
||||
for (QVector<ATBPaymentOption>::size_type j=0; j < paymentOptions.size(); ++j) {
|
||||
int const pop_id = paymentOptions.at(j).pop_id;
|
||||
std::optional<QVector<ATBPaymentRate>> const &paymentRates = cfg->getPaymentRateForKey(pop_id);
|
||||
if (paymentRates) {
|
||||
QVector<ATBPaymentRate> const &pr = paymentRates.value();
|
||||
if (pr.size() > 0) {
|
||||
price.netto = pr.at(0).pra_price;
|
||||
value.value_or(price);
|
||||
for (QVector<ATBPaymentRate>::size_type k=0; k < pr.size(); ++k) {
|
||||
if (pr.at(k).pra_payment_option_id == pop_id) {
|
||||
if (priceId == pr.at(k).pra_payment_unit_id) {
|
||||
price.netto = pr.at(k).pra_price;
|
||||
value = value.value_or(price);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -893,6 +909,30 @@ Calculator::GetDailyTicketPrice(Configuration* cfg,
|
||||
}
|
||||
} break;
|
||||
case PERMIT_TYPE::DAY_TICKET_CHILD: {
|
||||
std::optional<ATBCustomer> c = cfg->getCustomerForType(ATBCustomer::CustomerType::CHILD);
|
||||
if (c) {
|
||||
for (QVector<ATBDailyTicket>::size_type i=0; i<tickets.size(); ++i) {
|
||||
if (tickets[i].daily_ticket_clearance_customer_ids.contains(c.value().cust_id)) {
|
||||
int priceId = tickets[i].daily_ticket_price_id;
|
||||
QVector<ATBPaymentOption> const &paymentOptions = cfg->getAllPaymentOptions();
|
||||
for (QVector<ATBPaymentOption>::size_type j=0; j < paymentOptions.size(); ++j) {
|
||||
int const pop_id = paymentOptions.at(j).pop_id;
|
||||
std::optional<QVector<ATBPaymentRate>> const &paymentRates = cfg->getPaymentRateForKey(pop_id);
|
||||
if (paymentRates) {
|
||||
QVector<ATBPaymentRate> const &pr = paymentRates.value();
|
||||
for (QVector<ATBPaymentRate>::size_type k=0; k < pr.size(); ++k) {
|
||||
if (pr.at(k).pra_payment_option_id == pop_id) {
|
||||
if (priceId == pr.at(k).pra_payment_unit_id) {
|
||||
price.netto = pr.at(k).pra_price;
|
||||
value = value.value_or(price);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// [[fallthrough]];
|
||||
case PERMIT_TYPE::SHORT_TERM_PARKING: {
|
||||
|
Loading…
Reference in New Issue
Block a user