Well, for some reason on my last couple of run throughs, the SRS module hasn't been repeating the missed answer. To resolve this conundrum, the first order of business is to inspect the word schedule table on the db and see what's going on there.
Ah, here it is, still in shell history:
adb pull sdcard/data/com.kanjisoft.jlpt/jlpt .
Ok, it's actually under the new package name.
Ok, it looks like what you expect - I've got most of 200-400 in there. But a few are missing, and they should have come up in the select statement. If I reset the start and end numbers to go back to 300-400 - before it was incorrectly advanced - and run the quiz, questions are returned. So, the problem doesn't lay with the select statement. It lays with my counters - they are somehow getting fouled up. Well, this has happend before. I took a stab at a fix, but what ever I did didn't solve the problem, obviously. Now, the question is, why don't I just use the select statement as my criteria? Hmmm...I'd better be a bit careful, because browse mode relies on a little bit different selection criteria. Still, I might be able to convert that one as well.
Still, what's the problem with the numbers? Is it the app state thing? Ok, well, it works on a smaller scale, when I make the interval 4 questions.
It's probably something to do with correct answers not getting reset at some point. All the other numbers, like the number of questions, are taken from the question array.
if (appState.quizSequenceIndex < appState.quizSequence.size()) {
incrementQuestion();
QuestionActivity.this.setupDisplay();
} else { // finished
// Do this to keep highlight in reversed position from showing up
makeListTranparent(this.getListView());
int pct = CalcTotals.calcPctCorrect((AppState) this
.getApplicationContext());
if (pct < 100) {
text = "You correctly answered " + appState.correctAnswers
+ " out of " + appState.quizSequence.size()
+ " for a total score of " + pct + "%";
Toast.makeText(getApplicationContext(), text, Toast.LENGTH_LONG)
.show();
} else {
// pass control to next level activity
Intent intent = new Intent(QuestionActivity.this,
NextLevelActivity.class);
startActivity(intent);
}
It *could* have something to do with re-running the app, but it happened twice in a row, without ever exiting the app.
I think it's probably easiest if I just log the correct answers, and appState.quizSequence.size, and appState.quizSequenceIndex
Ok, here it is:
Log.d(TAG, "**************************************************************");
Log.d(TAG, "appState.correctAnswers: " + appState.correctAnswers );
Log.d(TAG, "appState.quizSequenceIndex : " + appState.quizSequenceIndex );
Log.d(TAG, "appState.quizSequence.size() : " + appState.quizSequence.size() );
int pct2 = CalcTotals.calcPctCorrect((AppState) this
.getApplicationContext());
Log.d(TAG, "percent: : " + pct2 );
Log.d(TAG, "**************************************************************");
Well, I went through about 100, 96 to be exact, checked the score each time, and it was fine.
Ok, I exited the question activity, and when I came back in, the numbers had been correctly re-done, i.e., it went from this:
D/QuestionActivity(18396): **************************************************************
D/QuestionActivity(18396): appState.correctAnswers: 1
D/QuestionActivity(18396): appState.quizSequenceIndex : 1
D/QuestionActivity(18396): appState.quizSequence.size() : 9
D/QuestionActivity(18396): percent: : 100
D/QuestionActivity(18396): **************************************************************
To this:
/QuestionActivity(18396): **************************************************************
D/QuestionActivity(18396): appState.correctAnswers: 1
D/QuestionActivity(18396): appState.quizSequenceIndex : 2
D/QuestionActivity(18396): appState.quizSequence.size() : 9
D/QuestionActivity(18396): percent: : 50
D/QuestionActivity(18396): **************************************************************
D
So, it regenerates the list, the correct answers..wait. Ah. The index is 2 - it should only be 1. It's not getting reset. It should get reset along with the quizSequence.
Well, actually that would be a better place for correct answers to get reset - they should be in the same place. Let's find where it gets reset.
Ok, well, here's the issue. We have a couple of modes - srs mode and browse mode. The srs mode can rely on the word schedule to whittle down the list of available questions within a range, but the browse mode doesn't have that luxury. So, I've steadfastly refused to save the current random quiz sequence when an app the app gets paused, because I don't think it's worth dealing with the added complexity - I mean, this is a quiz-game-thing. Especially now with the SRS mode, which really should be the main way of quizzing, so you get the repetition.
So, essentially, I'm just going to restart the quiz, srs mode or not, if the question display gets existed for any reason. It's just a simpler, saner approach.
So, the implications for the app are, we no longer persist the number of questions correct nor the current question number if the question screen gets exited. Start for scratch. The takeaway is, prefer srs mode or use short browse quizzes.
Ok, let's take those out of the persistent logic, and make the setting of them consistent.
Ok, give it another try:
/QuestionActivity(18861): **************************************************************
D/QuestionActivity(18861): appState.correctAnswers: 1
D/QuestionActivity(18861): appState.quizSequenceIndex : 2
D/QuestionActivity(18861): appState.quizSequence.size() : 7
D/QuestionActivity(18861): percent: : 50
D/QuestionActivity(18861): **************************************************************
And go back to StartActivity, then back into questions:
D/QuestionActivity(18861): **************************************************************
D/QuestionActivity(18861): appState.correctAnswers: 1
D/QuestionActivity(18861): appState.quizSequenceIndex : 1
D/QuestionActivity(18861): appState.quizSequence.size() : 5
D/QuestionActivity(18861): percent: : 100
D/QuestionActivity(18861): **************************************************************
Ok, and it got rest. That's the best solution.
Kill it click the icon, it goes right back into question, and we get this:
D/QuestionActivity(18919): **************************************************************
D/QuestionActivity(18919): appState.correctAnswers: 1
D/QuestionActivity(18919): appState.quizSequenceIndex : 1
D/QuestionActivity(18919): appState.quizSequence.size() : 2
D/QuestionActivity(18919): percent: : 100
D/QuestionActivity(18919): **************************************************************
Then let it time out for an incorrect answer:
D/QuestionActivity(18919): **************************************************************
D/QuestionActivity(18919): appState.correctAnswers: 1
D/QuestionActivity(18919): appState.quizSequenceIndex : 2
D/QuestionActivity(18919): appState.quizSequence.size() : 2
D/QuestionActivity(18919): percent: : 50
D/QuestionActivity(18919): **************************************************************
I/WindowManager
And we've advance to the next level. Sweet. *That's* what I should've done in the first place.
Ok. That's a wrap for now.
No comments:
Post a Comment