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

parley

  • sources
  • kde-4.12
  • kdeedu
  • parley
  • src
  • practice
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 int TestEntry::m_gradeFrom = 0;
19 int TestEntry::m_gradeTo = 1;
20 
21 TestEntry::TestEntry(KEduVocExpression *entry)
22  :m_entry(entry)
23  ,m_statisticCount(0)
24  ,m_statisticGoodCount(0)
25  ,m_statisticBadCount(0)
26  ,m_answeredCorrectInSequence(0)
27  ,m_correctAtFirstAttempt(false)
28  ,m_practiceFinished(false)
29  ,m_changeGrades(false)
30  ,m_lastPercentage(0.0)
31  ,m_lastError(0)
32 {}
33 
34 void TestEntry::setGradeTo(int to)
35 {
36  m_gradeTo = to;
37 }
38 
39 void TestEntry::setGradeFrom(int from)
40 {
41  m_gradeFrom = from;
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()
65 {
66  m_statisticCount++;
67  m_statisticGoodCount++;
68  m_answeredCorrectInSequence++;
69 
70  if ((!Prefs::altLearn()) || m_answeredCorrectInSequence == 3) {
71  m_changeGrades = true;
72  }
73 
74  // increase grade, if first time:
75  if ( !Prefs::altLearn() && m_statisticBadCount == 0 ) {
76  m_correctAtFirstAttempt = true;
77  } else {
78  // alt learn: 3 times right
79  if ( answeredCorrectInSequence() == 3 && m_statisticBadCount == 0 ) {
80  m_correctAtFirstAttempt = true;
81  }
82  }
83 
84 }
85 
86 bool TestEntry::changeGrades()
87 {
88  return m_changeGrades;
89 }
90 
91 void TestEntry::updateStatisticsWrongAnswer()
92 {
93  m_statisticCount++;
94  m_statisticBadCount++;
95  m_answeredCorrectInSequence = 0;
96  m_changeGrades = true;
97 }
98 
99 int TestEntry::gradeFrom()
100 {
101  return m_gradeFrom;
102 }
103 
104 int TestEntry::gradeTo()
105 {
106  return m_gradeTo;
107 }
108 
109 bool TestEntry::correctAtFirstAttempt()
110 {
111  return m_correctAtFirstAttempt;
112 }
113 
114 void TestEntry::setLastErrors(TestEntry::ErrorTypes errorTypes)
115 {
116  m_lastError = errorTypes;
117 }
118 
119 TestEntry::ErrorTypes TestEntry::lastErrors()
120 {
121  return m_lastError;
122 }
123 
124 void TestEntry::setLastPercentage(double percent)
125 {
126  m_lastPercentage = percent;
127 }
128 
129 double TestEntry::lastPercentage()
130 {
131  return m_lastPercentage;
132 }
133 
134 KEduVocExpression * TestEntry::entry()
135 {
136  return m_entry;
137 }
138 
139 QString TestEntry::conjugationTense() const
140 {
141  return m_conjugationTense;
142 }
143 
144 void TestEntry::setConjugationTense(const QString& tense)
145 {
146  m_conjugationTense = tense;
147 }
148 
149 QList<KEduVocWordFlags> TestEntry::conjugationPronouns() const
150 {
151  return m_conjugationPronouns;
152 }
153 
154 void TestEntry::setConjugationPronouns(const QList<KEduVocWordFlags>& flags)
155 {
156  m_conjugationPronouns = flags;
157 }
TestEntry::statisticCount
int statisticCount()
Definition: testentry.cpp:49
TestEntry::changeGrades
bool changeGrades()
check if the entry was finished and the practice backend may update the grades that will be saved to ...
Definition: testentry.cpp:86
Prefs::altLearn
static bool altLearn()
Get Use the Leitner learning method.
Definition: prefs.h:331
TestEntry::answeredCorrectInSequence
int answeredCorrectInSequence()
Definition: testentry.cpp:44
TestEntry::lastPercentage
double lastPercentage()
Definition: testentry.cpp:129
TestEntry::gradeFrom
static int gradeFrom()
Definition: testentry.cpp:99
TestEntry::lastErrors
ErrorTypes lastErrors()
Definition: testentry.cpp:119
TestEntry::setGradeTo
static void setGradeTo(int to)
Definition: testentry.cpp:34
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:139
testentry.h
TestEntry::setConjugationTense
void setConjugationTense(const QString &tense)
Definition: testentry.cpp:144
TestEntry::gradeTo
static int gradeTo()
Definition: testentry.cpp:104
TestEntry::setLastPercentage
void setLastPercentage(double percent)
Definition: testentry.cpp:124
TestEntry::conjugationPronouns
QList< KEduVocWordFlags > conjugationPronouns() const
In conjugation mode, use these pronouns for the entry.
Definition: testentry.cpp:149
TestEntry::updateStatisticsRightAnswer
void updateStatisticsRightAnswer()
update the internal statistics for this practice with a right result
Definition: testentry.cpp:64
TestEntry::setLastErrors
void setLastErrors(ErrorTypes errorTypes)
Definition: testentry.cpp:114
TestEntry::updateStatisticsWrongAnswer
void updateStatisticsWrongAnswer()
update the internal statistics for this practice with a wrong result
Definition: testentry.cpp:91
TestEntry::setConjugationPronouns
void setConjugationPronouns(const QList< KEduVocWordFlags > &flags)
Definition: testentry.cpp:154
TestEntry::statisticBadCount
int statisticBadCount()
Definition: testentry.cpp:54
TestEntry::correctAtFirstAttempt
bool correctAtFirstAttempt()
Definition: testentry.cpp:109
TestEntry::TestEntry
TestEntry(KEduVocExpression *entry)
Definition: testentry.cpp:21
TestEntry::setGradeFrom
static void setGradeFrom(int from)
Definition: testentry.cpp:39
TestEntry::entry
KEduVocExpression * entry()
Definition: testentry.cpp:134
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:42:06 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
  • kstars
  • libkdeedu
  •   keduvocdocument
  • 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