diff --git a/library/src/configuration.cpp b/library/src/configuration.cpp index 6ded661..67ad64f 100644 --- a/library/src/configuration.cpp +++ b/library/src/configuration.cpp @@ -499,7 +499,7 @@ Configuration::getDailyTicketsForAllKeys() const { } if (tickets.size() > 0) { - value.value_or(tickets); + value = value.value_or(tickets); } return value; @@ -510,18 +510,14 @@ Configuration::getDailyTicketsForKey(int key) const { QVector tickets; std::optional> value; - std::pair< - std::multimap::const_iterator, - std::multimap::const_iterator - > p = this->DailyTicket.equal_range(key); + tickets.clear(); - for (std::multimap::const_iterator it = p.first; - it != p.second; ++it) { + for (auto[it, rangeEnd] = this->DailyTicket.equal_range(key); it != rangeEnd; ++it) { tickets.append(it->second); } if (tickets.size() > 0) { - value.value_or(tickets); + value = value.value_or(tickets); } return value; @@ -538,7 +534,7 @@ Configuration::getPaymentRateForAllKeys() const { } if (paymentRates.size() > 0) { - value.value_or(paymentRates); + value = value.value_or(paymentRates); } return value; @@ -550,18 +546,14 @@ Configuration::getPaymentRateForKey(int key) const { QVector paymentRate; std::optional> value; - std::pair< - std::multimap::const_iterator, - std::multimap::const_iterator - > p = this->PaymentRate.equal_range(key); + paymentRate.clear(); - for (std::multimap::const_iterator it = p.first; - it != p.second; ++it) { + for (auto[it, rangeEnd] = this->PaymentRate.equal_range(key); it != rangeEnd; ++it) { paymentRate.append(it->second); } if (paymentRate.size() > 0) { - value.value_or(paymentRate); + value = value.value_or(paymentRate); } return value; @@ -590,7 +582,7 @@ Configuration::getWeekDayWorkTime(QTime const &time, Qt::DayOfWeek dayOfWeek) { ATBWeekDaysWorktime const &wt = it->second; if (QTime::fromString(wt.pwd_time_from.c_str(), Qt::ISODate) >= time && QTime::fromString(wt.pwd_time_to.c_str(), Qt::ISODate) < time) { - value.value_or(wt); + value = value.value_or(wt); } }