Thursday, June 9, 2011

SRS - the coding

Well, I spent some time today posting to some groups to get feedback on the UI. Now, I've updated the database with some dynamic data, the word_scheduling table. The first thing I need to do is copy the jlpt file from my home directory to the project. The next thing is to clear or delete the database file from the system, so it installs the new one. How did I do that before?

Well for now I'm going into shell to see if it lets me delete it.

Ah, I see - I think the db is on the internal storage, not the sdcard. So, I want to get rid of it first, then move the path to the sd card. I'm getting permission denied when I try to do it in adb shell.

Strange - it's supposed to be in /data/data/com.jlptquiz.app/databases/"

The database is installed for sure. The app's work.

It's on the machine somewhere. But astro find doesn't find it.

Ok, I remember. Just uninstall the app. Ok, before I do that, the app take up

11.79 mb

App: 4.11 mb
Data 7.68 mb.

Ok, now uninstall.

Ok, it install ok if I use this name:

private static final String DB_PATH = Environment
.getExternalStorageDirectory() + "/data/com.kanjisoft.jlpt/";


But, if is use:

private static final String DB_PATH = Environment
.getExternalStorageDirectory() + "/data/com.kanjisoft.jlpt/databases/";

it dies.

Oh, well.

App totals now:


11.79 mb

App: 4.11 mb
Data 7.68 mb.


4.11 mb total

App: 4.11 mb
Data 8 kb.

So, it's only counting data on internal storage. Cool.

Ok, I have to go play some tennis before the rain comes!

Oops - too late. Well, I'll play tomorrow for sure. Anyway, I need to make more progress on this.

Well, now that the database is over there, let's start getting into the code.

What do I need to do first? Well, I would like to check and make sure that if the customer gets it wrong, they will see the same question come up soon. Hmm. I just realized, my algorithm actually forces them to get all the *reviewed* questions right, as will as all the ones at that level. I think, just in case there are a ton of reviewed items, that they should only get the new ones right. Well, no, it's ok. Because if they dont' get out of the level, it will only make them redo the wrong ones.

Ok, so, the first test should be filtering the wrong ones.

Ok, so, let's just create or update a record in the database if they get it wrong - or right.

Ah, I just realized - my rating needs to be an enum.

public enum Rating {
WRONG, SLOW, MEDIUM, FAST
};


Which means I have to redo the rating in the database as a string with a default value of new. Too badd you can't drop a field.

Actually, since I'm only creating the record once it is reviewed, there's no reason for "New". But I do need a value for "Wrong".

Ok, here's the new create:

CREATE TABLE kanji_review_schedule
("_id" INTEGER,
"level" INTEGER,
"number" INTEGER,
rating TEXT(10),
last_review_date TEXT(25),
next_review_date TEXT(25))


Now let's cut it over again.

I'm having second thoughts about this. I'm pretty sure I can pull it off, but - there is a lot of tweaking and complexity involved. I think it's more important to just get the simple system out there. I'm only into it for a couple of days.

Well, let me do a couple of bug fixes and then think about it again.

No comments:

Post a Comment