[Userscript] WaniKani Lesson Cap

I don’t guess you could create a test account? I have a free level 3 WK account that I test stuff on. But I guess for Lesson Cap that won’t be helpful until you’ve built up some lessons.

Alright, added a guard to check for WKOF and loading default config if none is present.

Should work as intended again.

1 Like

Hi Valeth.
I’m wondering if there’s an issue running the script from in Chrome for macOS?

The bar is not showing in the lessons page and this message is writen on the Chrome Console:

Uncaught (in promise) TypeError: Cannot read property ‘srs_stage’ of undefined
at eval (userscript.html?id=3f92882b-b320-4de1-8a3e-8de0126b4855:268)
at Array.forEach ()
at calculate_score (userscript.html?id=3f92882b-b320-4de1-8a3e-8de0126b4855:266)
at eval (userscript.html?id=3f92882b-b320-4de1-8a3e-8de0126b4855:253)

I’m using macOS High Sierra 10.13.3

Thanks!

Same problem in Safari running on the same mac

Can confirm, running macOS elCapitan that Firefox is exhibiting the same exact symptoms.

Script is unusable in it’s current state : /, disables to review start button without showing the typical review score bar at the top.

Looks like some change in WKOF broke the script.
I suggest reverting back to the pre-WKOF version, because I don’t have time right now to fix this.

1 Like

Looks like WKOF 1.019 is the most recent version that is compatible with WKLC

@jamiecsd, @loperacano, @valeth,

The script seems to be working fine for me, and I’m on the latest version of wkof (1.0.22).
I’ve looked at the Lesson Cap code, and I don’t see anything wrong with the parts that use wkof.

One thing to note, though… I only installed Lesson Cap after seeing the above posts, so I’m working from a fresh install of Lesson cap.

I suppose I’d recommend clearing wkof cache and refreshing. Open the Javascript console (press F12 and click on the Console tab), then type the following command and press enter.

wkof.file_cache.clear()

If anyone that’s having trouble is willing to do a screen share session, I’m sure I could pinpoint the issue. I have a ConnectWise screen share server that I use for my business.

Alright, I looked into this and I know why it’s working for you; You are level 60.
It looks like the assignments endpoint is for some reason returning assignments for levels higher than your current one.
They do not have an assignments property in the returned object.
So I need to either add a level filter for the current user level or check the returned object.

I have no clue how to target “First level up to current level”.
Simply using +0 will only get the current one, 1 - +0 doesn’t work either.
I generally find the filter options a bit confusing at points, like - and + are seemingly used for both arithmetic operations and ranges.

1 Like

1 - +0 is correct for levels 1 to current level. I haven’t changed that code in the last month, but I’ll test again tonight.

assignments are only attached to the subjects (i.e. the returned items) when they are present, so you it’s a good idea to always check for their presence. If I understand what you’re saying, I’m guessing I missed a check somewhere in the backend? On the other hand, I have a try/catch around the filter functions, so if there’s an error, it should just filter out the object.

I’ll try my test account (a free level 3 account) to see if I can replicate the error.

I think I got this, all I needed to do was adding a “lock” to the inverted SRS filter.
Now locked items are excluded.

1 Like

Okay. But just to make sure I don’t have a bug of my own, was the error above occurring in the wkof code? (i.e. the error about srs_stage not found on undefined)

No, this was in my score calculation function, not WKOF directly

1 Like

Hi, I’m recently having issues with this (super helpful :slight_smile: ) script.

There seems to be a problem with the limit value not being stored reliably. It is not happening right away (so it might be a bit annoying to reproduce) but when I change the setting and come back after a while it is back to the default value (100) instead of the 200 that I’m trying to set it to.

I’m using Chrome 66.0 on MacOS.

Not a major problem for me since I can just change it and then move on to my lessons or override the default value in the script. Just wanted to let you know.

It doesn’t do this for me, but I’m using Firefox and not Chrome/Chromium.
Make sure you have the latest version of the script and WKOF installed.

If this still happens, please give me a list of your installed scripts.
Maybe there is some incompatability.

@irrelephant @valeth,

FYI, @bladepoint is having problems with forgotten settings on another script (a pre-release new version of Timeline), so I’m considering the possibility that there’s an issue in WKOF. I’ll investigate is this week and let you know whether it turns out to be in the framework or not.

That was my first guess since this has only started occurring after the script was migrated to WKOF. It hasn’t happened again within the last day but I’ll keep an eye on it.

So… the script just told me I have “Infinity Available.” I would LOVE to believe that I’m doing that good on my reviews, but, uh… I’m not THAT good.

Any idea what’s going on?

EDIT: I did lessons. I was only able to do 4 sets, and now it’s properly telling me 0 available.