• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

parley

  • sources
  • kde-4.14
  • kdeedu
  • parley
  • src
  • collection
testentry.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  Copyright 2007 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
3  ***************************************************************************/
4 
5 /***************************************************************************
6  * *
7  * This program is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  ***************************************************************************/
13 
14 #include "testentry.h"
15 
16 #include "prefs.h"
17 
18 
19 TestEntry::TestEntry(KEduVocExpression *entry)
20  : m_entry(entry)
21  , m_languageFrom(998) // Bogus number to make sure that it's set correctly later
22  , m_languageTo(999)
23  , m_statisticCount(0)
24  , m_statisticGoodCount(0)
25  , m_statisticBadCount(0)
26  , m_answeredCorrectInSequence(0)
27  , m_correctAtFirstAttempt(false)
28  , m_shouldChangeGrades(false)
29  , m_isUnseenQuestion(false)
30  , m_lastPercentage(0.0)
31  , m_lastError(0)
32 {}
33 
34 void TestEntry::setLanguageFrom(int from)
35 {
36  m_languageFrom = from;
37 }
38 
39 void TestEntry::setLanguageTo(int to)
40 {
41  m_languageTo = to;
42 }
43 
44 int TestEntry::answeredCorrectInSequence()
45 {
46  return m_answeredCorrectInSequence;
47 }
48 
49 int TestEntry::statisticCount()
50 {
51  return m_statisticCount;
52 }
53 
54 int TestEntry::statisticBadCount()
55 {
56  return m_statisticBadCount;
57 }
58 
59 int TestEntry::statisticGoodCount()
60 {
61  return m_statisticGoodCount;
62 }
63 
64 void TestEntry::updateStatisticsRightAnswer(grade_t currentPreGrade, grade_t currentGrade)
65 {
66  m_statisticCount++;
67  m_statisticGoodCount++;
68  m_answeredCorrectInSequence++;
69  m_isUnseenQuestion = false;
70 
71  // Check if this is the first time the user is seeing this question (not practiced).
72  if (currentPreGrade == KV_NORM_GRADE && currentGrade == KV_NORM_GRADE) {
73  m_isUnseenQuestion = true;
74  }
75 
76  if ((!Prefs::altLearn()) || m_answeredCorrectInSequence == 3) {
77  m_shouldChangeGrades = true;
78  }
79 
80  // Make changes in statistics if answered correctly and not answered wrong in current test
81  if (!Prefs::altLearn() && m_statisticBadCount == 0) {
82  m_correctAtFirstAttempt = true;
83  } else {
84  // alt learn: 3 times right
85  if (answeredCorrectInSequence() == 3 && m_statisticBadCount == 0) {
86  m_correctAtFirstAttempt = true;
87  }
88  }
89 }
90 
91 bool TestEntry::shouldChangeGrades()
92 {
93  return m_shouldChangeGrades;
94 }
95 
96 void TestEntry::updateStatisticsWrongAnswer(grade_t currentPreGrade, grade_t currentGrade)
97 {
98  m_statisticCount++;
99  m_statisticBadCount++;
100  m_answeredCorrectInSequence = 0;
101  m_shouldChangeGrades = true;
102  m_isUnseenQuestion = false;
103 
104  if (currentPreGrade == KV_NORM_GRADE && currentGrade == KV_NORM_GRADE) {
105  m_isUnseenQuestion = true;
106  }
107 }
108 
109 int TestEntry::languageFrom() const
110 {
111  return m_languageFrom;
112 }
113 
114 int TestEntry::languageTo() const
115 {
116  return m_languageTo;
117 }
118 
119 bool TestEntry::isUnseenQuestion() const
120 {
121  return m_isUnseenQuestion;
122 }
123 
124 bool TestEntry::correctAtFirstAttempt()
125 {
126  return m_correctAtFirstAttempt;
127 }
128 
129 void TestEntry::setLastErrors(TestEntry::ErrorTypes errorTypes)
130 {
131  m_lastError = errorTypes;
132 }
133 
134 TestEntry::ErrorTypes TestEntry::lastErrors()
135 {
136  return m_lastError;
137 }
138 
139 void TestEntry::setLastPercentage(double percent)
140 {
141  m_lastPercentage = percent;
142 }
143 
144 double TestEntry::lastPercentage()
145 {
146  return m_lastPercentage;
147 }
148 
149 KEduVocExpression * TestEntry::entry() const
150 {
151  return m_entry;
152 }
153 
154 QString TestEntry::conjugationTense() const
155 {
156  return m_conjugationTense;
157 }
158 
159 void TestEntry::setConjugationTense(const QString& tense)
160 {
161  m_conjugationTense = tense;
162 }
163 
164 QList<KEduVocWordFlags> TestEntry::conjugationPronouns() const
165 {
166  return m_conjugationPronouns;
167 }
168 
169 void TestEntry::setConjugationPronouns(const QList<KEduVocWordFlags>& flags)
170 {
171  m_conjugationPronouns = flags;
172 }
TestEntry::statisticCount
int statisticCount()
Definition: testentry.cpp:49
Prefs::altLearn
static bool altLearn()
Get Use the Leitner learning method.
Definition: prefs.h:336
TestEntry::entry
KEduVocExpression * entry() const
Definition: testentry.cpp:149
TestEntry::setLanguageFrom
void setLanguageFrom(int from)
Definition: testentry.cpp:34
TestEntry::answeredCorrectInSequence
int answeredCorrectInSequence()
Definition: testentry.cpp:44
TestEntry::lastPercentage
double lastPercentage()
Definition: testentry.cpp:144
TestEntry::updateStatisticsRightAnswer
void updateStatisticsRightAnswer(grade_t currentPreGrade, grade_t currentGrade)
update the internal statistics for this practice with a right result
Definition: testentry.cpp:64
TestEntry::setLanguageTo
void setLanguageTo(int to)
Definition: testentry.cpp:39
TestEntry::lastErrors
ErrorTypes lastErrors()
Definition: testentry.cpp:134
TestEntry::statisticGoodCount
int statisticGoodCount()
Definition: testentry.cpp:59
prefs.h
TestEntry::conjugationTense
QString conjugationTense() const
In conjugation mode, use this tense for the entry.
Definition: testentry.cpp:154
testentry.h
TestEntry::setConjugationTense
void setConjugationTense(const QString &tense)
Definition: testentry.cpp:159
TestEntry::setLastPercentage
void setLastPercentage(double percent)
Definition: testentry.cpp:139
TestEntry::updateStatisticsWrongAnswer
void updateStatisticsWrongAnswer(grade_t currentPreGrade, grade_t currentGrade)
update the internal statistics for this practice with a wrong result
Definition: testentry.cpp:96
TestEntry::conjugationPronouns
QList< KEduVocWordFlags > conjugationPronouns() const
In conjugation mode, use these pronouns for the entry.
Definition: testentry.cpp:164
QString
QList< KEduVocWordFlags >
TestEntry::setLastErrors
void setLastErrors(ErrorTypes errorTypes)
Definition: testentry.cpp:129
TestEntry::setConjugationPronouns
void setConjugationPronouns(const QList< KEduVocWordFlags > &flags)
Definition: testentry.cpp:169
TestEntry::statisticBadCount
int statisticBadCount()
Definition: testentry.cpp:54
TestEntry::languageFrom
int languageFrom() const
Definition: testentry.cpp:109
TestEntry::correctAtFirstAttempt
bool correctAtFirstAttempt()
Definition: testentry.cpp:124
TestEntry::TestEntry
TestEntry(KEduVocExpression *entry)
Definition: testentry.cpp:19
TestEntry::languageTo
int languageTo() const
Definition: testentry.cpp:114
TestEntry::shouldChangeGrades
bool shouldChangeGrades()
check if the entry was finished and the practice backend may update the grades that will be saved to ...
Definition: testentry.cpp:91
TestEntry::isUnseenQuestion
bool isUnseenQuestion() const
Definition: testentry.cpp:119
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:15:56 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

parley

Skip menu "parley"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal