IsYearPeriodActive(): return true, even if no YearPeriod is given in tariff-json-file.

This commit is contained in:
Gerhard Hoffmann 2023-12-12 10:23:45 +01:00
parent 9dcf7a8f30
commit 282a412ef5

View File

@ -197,7 +197,8 @@ bool Utilities::IsYearPeriodActive(Configuration* cfg, struct tm* currentDateTim
} }
bool Utilities::IsYearPeriodActive(Configuration const *cfg, QDateTime const &dt) { bool Utilities::IsYearPeriodActive(Configuration const *cfg, QDateTime const &dt) {
if (std::none_of(cfg->YearPeriod.cbegin(), if ((cfg->YearPeriod.size() > 0) &&
std::none_of(cfg->YearPeriod.cbegin(),
cfg->YearPeriod.cend(), cfg->YearPeriod.cend(),
[&dt](std::pair<int, ATBPeriodYear> const &year) { [&dt](std::pair<int, ATBPeriodYear> const &year) {
QDate const d(2004, // 2004 is a leap year QDate const d(2004, // 2004 is a leap year