Changeset View
Changeset View
Standalone View
Standalone View
src/practice/sessionmanagerfixed.cpp
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | 41 | { | |||
---|---|---|---|---|---|
48 | // Pick N new words if there are any into the active set. | 48 | // Pick N new words if there are any into the active set. | ||
49 | int numNewWords = 0; | 49 | int numNewWords = 0; | ||
50 | int i = 0; | 50 | int i = 0; | ||
51 | while (i < m_allTestEntries.count() | 51 | while (i < m_allTestEntries.count() | ||
52 | && numNewWords < MaxNewWords | 52 | && numNewWords < MaxNewWords | ||
53 | && m_currentEntries.count() < MaxEntries) | 53 | && m_currentEntries.count() < MaxEntries) | ||
54 | { | 54 | { | ||
55 | TestEntry *it = m_allTestEntries.at(i); | 55 | TestEntry *it = m_allTestEntries.at(i); | ||
56 | if (it->entry()->translation(it->languageTo())->grade() == 0 | 56 | if (it->practiceModeDependentMinGrade() == 0 | ||
57 | && it->entry()->translation(it->languageTo())->preGrade() == 0) { | 57 | && it->practiceModeDependentMinPreGrade() == 0) { | ||
58 | m_currentEntries.append(it); | 58 | m_currentEntries.append(it); | ||
59 | numNewWords++; | 59 | numNewWords++; | ||
60 | } | 60 | } | ||
61 | 61 | | |||
62 | ++i; | 62 | ++i; | ||
63 | } | 63 | } | ||
64 | 64 | | |||
65 | // Pick the rest of the words from the already practiced ones. | 65 | // Pick the rest of the words from the already practiced ones. | ||
66 | // Use higher graded entries before lower graded ones. | 66 | // Use higher graded entries before lower graded ones. | ||
67 | for (int grade = KV_MAX_GRADE; grade > 0 ; --grade) { | 67 | for (int grade = KV_MAX_GRADE; grade > 0 ; --grade) { | ||
68 | if (m_currentEntries.count() >= MaxEntries) { | 68 | if (m_currentEntries.count() >= MaxEntries) { | ||
69 | break; | 69 | break; | ||
70 | } | 70 | } | ||
71 | 71 | | |||
72 | // Step through all entries and collect those at the current | 72 | // Step through all entries and collect those at the current | ||
73 | // grade until the session is filled. | 73 | // grade until the session is filled. | ||
74 | foreach (TestEntry *entry, m_allTestEntries) { | 74 | foreach (TestEntry *entry, m_allTestEntries) { | ||
75 | if (entry->entry()->translation(entry->languageTo())->grade() == grade) { | 75 | if (entry->practiceModeDependentMaxGrade() == grade) { | ||
76 | m_currentEntries.append(entry); | 76 | m_currentEntries.append(entry); | ||
77 | } | 77 | } | ||
78 | if (m_currentEntries.count() >= MaxEntries) { | 78 | if (m_currentEntries.count() >= MaxEntries) { | ||
79 | break; | 79 | break; | ||
80 | } | 80 | } | ||
81 | } | 81 | } | ||
82 | } | 82 | } | ||
83 | 83 | | |||
84 | // If there is still room in the session, pick the rest of the | 84 | // If there is still room in the session, pick the rest of the | ||
85 | // words from the ones with pregrades. Also here, use higher | 85 | // words from the ones with pregrades. Also here, use higher | ||
86 | // graded entries before lower graded ones. | 86 | // graded entries before lower graded ones. | ||
87 | for (int preGrade = KV_MAX_GRADE; preGrade > 0 ; --preGrade) { | 87 | for (int preGrade = KV_MAX_GRADE; preGrade > 0 ; --preGrade) { | ||
88 | if (m_currentEntries.count() >= MaxEntries) { | 88 | if (m_currentEntries.count() >= MaxEntries) { | ||
89 | break; | 89 | break; | ||
90 | } | 90 | } | ||
91 | 91 | | |||
92 | // Step through all entries and collect those at the current | 92 | // Step through all entries and collect those at the current | ||
93 | // grade until the session is filled. | 93 | // grade until the session is filled. | ||
94 | foreach (TestEntry *entry, m_allTestEntries) { | 94 | foreach (TestEntry *entry, m_allTestEntries) { | ||
95 | if (entry->entry()->translation(entry->languageTo())->preGrade() == preGrade) { | 95 | if (entry->practiceModeDependentMaxPreGrade() == preGrade) { | ||
96 | m_currentEntries.append(entry); | 96 | m_currentEntries.append(entry); | ||
97 | } | 97 | } | ||
98 | if (m_currentEntries.count() >= MaxEntries) { | 98 | if (m_currentEntries.count() >= MaxEntries) { | ||
99 | break; | 99 | break; | ||
100 | } | 100 | } | ||
101 | } | 101 | } | ||
102 | } | 102 | } | ||
103 | 103 | | |||
Show All 12 Lines |