blob: 5e2b55890a4a759d0f389fa804a8ab90b6908623 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#include "ScheduledPage.h"
#include "../dictionary/CardPack.h"
ScheduledPage::ScheduledPage(const StatisticsParams* statParams):
TimeChartPage(statParams)
{
init();
}
QList<QDateTime> ScheduledPage::getDates(const CardPack* pack) const
{
QList<QDateTime> scheduled = pack->getScheduledDates();
adjustScheduledRecords(scheduled);
return scheduled;
}
void ScheduledPage::adjustScheduledRecords(QList<QDateTime>& scheduled)
{
const QDate curDate = QDate::currentDate();
const QTime zeroTime = QTime(0, 0);
for(int i = 0; i < scheduled.size(); i++)
{
QDateTime& dateTime = scheduled[i];
if(dateTime.date() < curDate)
dateTime = QDateTime(curDate, zeroTime);
else if(laterThisDay(dateTime))
dateTime = QDateTime(curDate.addDays(1), zeroTime);
}
}
bool ScheduledPage::laterThisDay(QDateTime& dateTime)
{
return dateTime.date() == QDate::currentDate() &&
dateTime > QDateTime::currentDateTime();
}
|