trevorld / Hanzi_Stats

Anki plugin which calculates number of Hanzi you have learned so far.
GNU General Public License v3.0
15 stars 4 forks source link

Configurable column reading #8

Closed infernalis closed 6 years ago

infernalis commented 6 years ago

Added the ability to configure which column to use when calculating HSK statistics.

Columns can either be specified by index (starting at 0), "all", or "sortField". The default behavior is to use sortField, which matches the current implementation. It should be noted that sortField is not actually the 'first' field as stated in the projects README. The config.md file is shown to the user when they configure the plugin, the explanation may need some tweaking if it's not clear enough.

For some extra context, the Anki database schema can be found here: https://github.com/ankidroid/Anki-Android/wiki/Database-Structure

infernalis commented 6 years ago

found some bugs, will fix them and recommit

infernalis commented 6 years ago

fixed! Specifying specific columns should be much more robust. It will still throw an error if the user specifies a column that they dont have, but it wont crash the application (just the plugin) so I dont see this as a major issue.

trevorld commented 6 years ago

Thanks! I'll try to re-install Anki beta and test it out in the next couple months. I'm defending my PhD dissertation in the next few weeks so I'll be unusually busy...

trevorld commented 6 years ago

Consistency tests that I should run on my deck with this plugin after re-installing the Anki beta:

  1. With default (apparently the sort field) plugin behaves as before
  2. With field "0" ("Hanzi") behaves as before
  3. With "all" fields shows more characters recognized
  4. With field "1" ("Pinyin") should show no recognized characters
  5. With field "4" ("Components") probably shows less recognized characters than field "0"
  6. With field "6" ("Examples") probably shows more recognized characters than field "0"
  7. With field "8" ("Classifier") should show a lot less recognized characters than field "0"
infernalis commented 6 years ago

You might be off by 1 on the indexes (it shouldn't start at 0). You can enter what you see in the field browser without having to mentally do the conversion between count and index. So in the screenshot below if I configure it to pull from Field 2 (Simplified) with this config {"fieldToUseForStats":"2"} it will, in the code, secretly subtract one and pull index 1 from the list of fields.

image

Don't feel rushed to work on this, I had a lot of fun learning to work in Anki and I already get to use the changes locally. Good luck with your dissertation!

trevorld commented 6 years ago

Thanks for the plugin! I noticed that if you had a high field number (i.e. if your Hanzi cards had more fields than other cards) the plugin would crash so I added an if statement to check if that card had enough fields (and if not do nothing).

trevorld commented 6 years ago

Updated version of plugin uploaded to AnkiWeb...

infernalis commented 6 years ago

Thank you very much for testing this so fast! I'm loving the rest of the plugin, super useful. Good luck with your PhD!