Browse Source

make the percentages below a minimum number of guesses calculated by number left to reach a minimum good guess count

1.0-fixes
Wes Hardaker 11 years ago
parent
commit
93dd348f8b
  1. 6
      MorseStat.cpp
  2. 2
      MorseStat.h
  3. 6
      modes/LetterTrainingMode.cpp

6
MorseStat.cpp

@ -17,9 +17,13 @@ int MorseStat::getGoodCount() {
return m_goodCount;
}
int MorseStat::getGoodPercentage() {
int MorseStat::getGoodPercentage(int minStartingGood) {
if (m_tryCount == 0)
return 0;
if (minStartingGood != 0 && m_goodCount < minStartingGood) {
qDebug() << "not good enough: " << m_goodCount << "/" << minStartingGood;
return 100 * m_goodCount / minStartingGood;
}
return int(100.0 * float(m_goodCount)/float(m_tryCount));
}

2
MorseStat.h

@ -15,7 +15,7 @@ public:
float getAverageTime();
int getTryCount();
int getGoodCount();
int getGoodPercentage();
int getGoodPercentage(int minStartingGood = 0);
void addStat(float newtime, bool successful);

6
modes/LetterTrainingMode.cpp

@ -73,7 +73,7 @@ QTime LetterTrainingMode::startNextTrainingKey() {
if (stat->getTryCount() == 0 && m_doEntireSequence)
thisPercent = 50;
else
thisPercent = stat->getGoodPercentage();
thisPercent = stat->getGoodPercentage(m_minimumTries);
totalPercent += thisPercent;
minPercent = qMin(minPercent, thisPercent);
@ -96,7 +96,7 @@ QTime LetterTrainingMode::startNextTrainingKey() {
qDebug() << " adding " << *letter << " / " << thisPercent;
letters.append(QPair<QChar, int>(*letter, thisPercent));
if(thisPercent <= m_percentGoal || stat->getTryCount() <= m_minimumTries) {
if(thisPercent <= m_percentGoal || stat->getTryCount() < m_minimumTries) {
qDebug() << " too low: " << *letter << " / " << thisPercent << " / " << stat->getTryCount();
if (++badLetters >= m_maxBadLetters || stat->getTryCount() <= m_minimumTries) {
// enough letters aren't accurate; break here
@ -170,7 +170,7 @@ void LetterTrainingMode::updateGraphs()
#ifndef SMALL_DEVICE
foreach(QChar theLetter, m_trainingSequence) {
m_progressBars[theLetter]->setRange(0, 100);
m_progressBars[theLetter]->setValue(getStat(theLetter)->getGoodPercentage());
m_progressBars[theLetter]->setValue(getStat(theLetter)->getGoodPercentage(m_minimumTries));
}
// qDebug() << "max graph WPM: " << fastestWPM;
#endif

Loading…
Cancel
Save