If you’ve been using the Leech Training script, you may have encountered the occasional timeout, or bug that needs me to wipe out your progress from the database. Sorry about that! I’ve been meaning to rewrite it for some time now, and found a good amount of time over the festive period. So, if you use the leech trainer, and the phrase “Postman is an app I’m familiar with for debugging” is familiar to you, then read on! If the second part is nonsense to you, I’ll probably enlist your help at a later date.
There’s a newer version of the user script available to install, and within that, you’ll see we have a new URL for the API.
If you install that userscript, you’ll need to disable the existing one or else they’ll probably trample all over each other, but if you get it installed correctly you should see the familiar “Leeches” button appear at the top.
What’s Changed?
Externally, not all that much, but it should hopefully be a little faster to respond when refreshing your stats. The backend now makes use of the updated_after
options in WK API so it’s only retrieving small chunks each time.
The length of a leeches training session is currently set to 3 because I was getting tired of typing while testing, so don’t worry if it seems short!
The leech score is currently set to 1.0, but you can now change it. That’s where postman comes in. If you take the URL linked to earlier, and send a PATCH request to /user
with a JSON body of { leech_score: 1.2 }
then you’ll set your leech score to 1.2. Refreshing your leeches count should then show you a lower number. To authenticate your request, use an Authorization
header set to Bearer <YOUR API KEY>
.
If things somehow get screwed up with your stats, you can send a DELETE request to '/leecheswith the same authorization and it'll clear out all of your cached stats. Sending a GET to
/leeches` will then refresh it all.
If you’ve time to try it and find things I’ve missed from my single-user testing, that would be great. The data used by this version of the trainer has nothing to do with the current production setup, so you’ll not break that, and you might well see some differences in counts.
Still To Do For Parity
- Adding in visually similar kanji to lessons
- Caching trained leeches in the event you don’t finish the full quiz