Implement
std::optional<QVector<ATBTariffProduct>> getTariffProductForAllKeys() const; std::optional<QVector<ATBTariffProduct>> getTariffProductForProductId(int id) const; std::optional<QVector<ATBTariffProduct>> getTariffProductForProductId(PermitType permitType) const;
This commit is contained in:
parent
afb0e20dd2
commit
e980d8c451
@ -561,6 +561,48 @@ QVector<ATBPaymentOption> &Configuration::getAllPaymentOptions() {
|
|||||||
return this->currentPaymentOptions;
|
return this->currentPaymentOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::optional<QVector<ATBTariffProduct>>
|
||||||
|
Configuration::getTariffProductForAllKeys() const {
|
||||||
|
QVector<ATBTariffProduct> products;
|
||||||
|
std::optional<QVector<ATBTariffProduct>> value;
|
||||||
|
|
||||||
|
products.clear();
|
||||||
|
|
||||||
|
for (std::multimap<int, ATBTariffProduct>::const_iterator it = this->TariffProduct.cbegin();
|
||||||
|
it != this->TariffProduct.cend(); ++it) {
|
||||||
|
products.append(it->second);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (products.size() > 0) {
|
||||||
|
value = value.value_or(products);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<QVector<ATBTariffProduct>>
|
||||||
|
Configuration::getTariffProductForProductId(PermitType permitType) const {
|
||||||
|
QVector<ATBTariffProduct> products;
|
||||||
|
std::optional<QVector<ATBTariffProduct>> value;
|
||||||
|
|
||||||
|
products.clear();
|
||||||
|
|
||||||
|
for (auto[it, rangeEnd] = this->TariffProduct.equal_range(permitType); it != rangeEnd; ++it) {
|
||||||
|
products.append(it->second);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (products.size() > 0) {
|
||||||
|
value = value.value_or(products);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<QVector<ATBTariffProduct>>
|
||||||
|
Configuration::getTariffProductForProductId(int id) const {
|
||||||
|
return getTariffProductForProductId(PermitType(id));
|
||||||
|
}
|
||||||
|
|
||||||
std::optional<QVector<ATBDailyTicket>>
|
std::optional<QVector<ATBDailyTicket>>
|
||||||
Configuration::getDailyTicketsForAllKeys() const {
|
Configuration::getDailyTicketsForAllKeys() const {
|
||||||
QVector<ATBDailyTicket> tickets;
|
QVector<ATBDailyTicket> tickets;
|
||||||
|
Loading…
Reference in New Issue
Block a user