summaryrefslogtreecommitdiff
path: root/src/study/StudyRecord.h
blob: abe7ef9b211d09571a0a2f19c567209dd74d7b23 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef STUDYRECORD_H
#define STUDYRECORD_H

#include <iostream>
#include <QDateTime>

using std::ostream;

class ScheduleParams;

struct StudyRecord
{
public:
    static const int MaxAnswerTime = 180;   // sec
    enum Level
    {
        New = 1,
        ShortLearning = 2,
        LongLearning = 3,
        Repeating = 10
    };
    enum Grade
    {
        Unknown = 1,
        Incorrect = 2,
        Difficult = 3,
        Good = 4,
        Easy = 5,
        GradesNum = 5
    };
    
public:
    StudyRecord();
    StudyRecord(int level, int grade, double easiness, double interval);

    bool timeTriggered() const;
    int getSecsToNextRepetition() const;
    bool isOneDayOld() const;
    bool isLearning() const;
    int getScheduledTodayReviews() const;
    bool isReviewedToday() const;
    bool isActivatedToday() const;
    bool operator==( const StudyRecord& aOther ) const;
    void setRecallTime(double time);
    void setAnswerTime(double time);

private:
    static QDateTime shiftedDate(const QDateTime& aDate);

public:
    QDateTime date;
    int level;
    double interval;     // days
    int grade;
    double easiness;
    double recallTime;   // sec
    double answerTime;   // Full answer time: recall + grading
};

ostream& operator<<(ostream& os, const StudyRecord& study);

#endif