summaryrefslogtreecommitdiff
path: root/src/study/StudyRecord.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/study/StudyRecord.h')
-rw-r--r--src/study/StudyRecord.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/study/StudyRecord.h b/src/study/StudyRecord.h
new file mode 100644
index 0000000..abe7ef9
--- /dev/null
+++ b/src/study/StudyRecord.h
@@ -0,0 +1,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