UI: StatisticsPage: Exclude 2-nd hour from active period.

This commit is contained in:
Nodir Temirkhodjaev 2018-09-05 19:03:36 +05:00
parent f4a06fd032
commit 7960bbffa7
2 changed files with 5 additions and 4 deletions

View File

@ -143,10 +143,11 @@ void Test::activePeriod()
const qint32 unixHour = DateUtil::getUnixHour(unixTime);
QVERIFY(DateUtil::isHourBetween(unixHour, unixDay, 0, 24));
QVERIFY(DateUtil::isHourBetween(unixHour, unixDay, 15, 15));
QVERIFY(DateUtil::isHourBetween(unixHour, unixDay, 15, 16));
QVERIFY(DateUtil::isHourBetween(unixHour, unixDay, 15, 10));
QVERIFY(DateUtil::isHourBetween(unixHour, unixDay, 16, 15));
QVERIFY(!DateUtil::isHourBetween(unixHour, unixDay, 15, 15));
QVERIFY(!DateUtil::isHourBetween(unixHour, unixDay, 0, 15));
QVERIFY(!DateUtil::isHourBetween(unixHour, unixDay, 16, 15));
QVERIFY(!DateUtil::isHourBetween(unixHour, unixDay, 24, 0));
QVERIFY(!DateUtil::isHourBetween(unixHour, unixDay, 16, 14));
QVERIFY(!DateUtil::isHourBetween(unixHour, unixDay, 16, 24));

View File

@ -87,6 +87,6 @@ bool DateUtil::isHourBetween(qint32 unixHour, qint32 unixDay,
const int hour = unixHour - unixDay;
return fromHour <= toHour
? (hour >= fromHour && hour <= toHour)
: (hour == 0 || hour >= fromHour || hour <= toHour);
? (hour >= fromHour && hour < toHour)
: (hour == 0 || hour >= fromHour || hour < toHour);
}