[Userscript] WK Anti-burnout

Notice!

This script is no longer under active development and will stop functioning the 18th of April. Potential users are suggested to use the lesson cap script, which has the same functionality as this script, but is under active development.

What is it?

This script limits your lessons to avoid burnout, and displays some information at the top of the lessons page.

Why would I want this?

From time to time, the question “How many apprentice items should I keep” is asked. The answer is generally given as a value between 70 and 150. While the idea behind this is sound (avoiding burnout by limiting lessons), the approach is limited. This script is more accurate, as it counts not only items in all SRS groups (apprentice, guru[…]), but also all SRS levels, from one to nine. It automagically blocks you from adding too many lessons if it detects you will have too many reviews.

How does it work?

Put simply, it calculates a score for the amount of items you have in each SRS level. Currently, the script multiplies the amount of items in the level with 3, 1.5, 0.52, 0.255, 0.07, 0.035, 0.015 and 0.005, ascending with level (burned items obviously do not count towards your score). One newly learned item is worth 3 points, after one successful review, it’s worth 1.5 and so on. You can adjust the aggressiveness of the script with the “spiciness” option. A low spiciness will mean fewer reviews per day, a high spiciness will mean more reviews per day.

How do I use it?

You have to have a userscript manager installed, like Greasemonkey (Firefox) or Tampermonkey (Chrome). After you have that, you can navigate to the URL provieded below, under “Download”, and click install. You then navigate to your lessons page, where you will be asked for your API v2 key, a number for spiciness and items per lesson. You can find your API v2 Key on the account settings page, and “items per lesson” under “Lesson batch sizing” on the app settings page. I suggest you set this to 3, but you can use the script with any setting you want.

Further usage instructions

The bar at the top of the page shows you the amount of items in each SRS level. In parenthesis is the spiciness score for that level. ie, if you have 4 level one items, the score is 12, if you have 19 level two items, the score for that level will be 28.5. The total is added up in the box with the text: “全額”. You can adjust your settings if you click the text “設定”

The number showed next to “Start session” in the box with the text “回”, is the amount of sessions of lessons you can do without exceeding your max spiciness score. Try not to do more than this amount, or this script will be quite pointless. If one session of lessons would put you over max spice, the script will remove the link to start your session. This is why I suggest a low setting for lesson batch sizing in your account page and in this scripts options.

Does it work?

Yes!

Disclaimer

This script is made with the new API V2, and likely to break at some/many points. I’ll try to update the script then, but buyer beware anyway. It is also not tested to any real extent. If any breakage occurs, it was not on purpose. Sorry.

I’m not a computer programmer by trade. This script is probably stupid and inefficient. It seems to work for me though, so I wanted to share it.

On the bright side, if you want to make the script better, feel free to copy it and use it any way you want. License information. Maybe you can make a better script than me. I’d probably download it.

Download

You can find the script on Greasyfork.

Use without userscript

You can see your scores on this site. Press the [設定]-key to reset your API-key.

20 Likes

How many scovilles is a Leebo? :thinking:


Interesting idea. Best of luck with it moving forward!

12 Likes

He who controls the spice controls the universe

Well, my personal estimate is that your spiciness roughly corresponds to the number showed in the box called “Next day” on your frontpage, so long as you do your lessons and reviews regularly. As we know though, the amount of reviews you have to do per day will be a little higher than the number showed in the “next day” box, so spiciness is essentially “this is the amount of reviews you will have to do in a day”, +/- 50, if you’re not a silly willy and added all the items on a Thursday. (With this script you won’t be able to add all the items on a Thursday anyway, so no worries there).

1 Like

Looks… Spicy

1 Like

Your script has shown me that greasyfork needs to update their Code tab to do syntax highlighting for the newer JavaScript keywords.

Also, just so you know, there is a !== to go along with ===, which you are already using. It is generally recommended to use === and !== instead of == and !=.

Thanks for the feedback. I’ll try to go through the script and change occurrences. I was not aware that javascript did weird type coercion if you use double equals, (I actually only used triple equals at some point because my code editor yelled at me, I should probably have looked it up then.)

I changed the code as per your suggestions. :slight_smile:

At first I thought I would use the async/await functions, but I actually found I didn’t need them. I’m not sure I really needed to use the newer JS keywords, but considering this script is mostly for Chrome and Firefox users, I don’t think I’ll need to worry about compatibility, and the fat arrows are very concise.

EDIT 2: Did some more changes to improve readability and clean up some debugging code. Also changed the config id because it seems like there might be collisions if I use the default value. This may mean anyone who installed the script and updated now needs to enter their API key again, sorry about that.

Brilliant.

I like this a lot.
Wish I had this script a month ago, when I was trying to figure out how to get my daily reviews back to a manageable amount.

Is there anyway this script could be accessed on mobile?
I’m on iOS and usually do my reviews and lessons on the bus during my commute.
I really like your spiciness calculations and wish I could see them on the go.

I’m working on something for that actually! Give me a week or something (hopefully less but you never know) and I’ll probably have something ready for you.

2 Likes

Question - Where does the score for the newly learnt lessons show?

Newly learnt lessons will be in the leftmost field. “Apprentice 1”. In your case, you might just have done a batch of 5 lessons, and the score for that will be 15, as indicted in the parenthesis!

Does that answer your question?

That wasn’t really what I was asking; in your OP you said:

So shouldn’t the 5 lessons I just did count as 6 points each, and not 3? Or is the 6 points counted towards lessons not yet done?

Oh, I’m quite silly, that’s my fault. All scores are actually divided by two for… aesthetic reasons. I should edit my first post.

* The reason they are divided is to make a baseline 100 spiciness a “normal” setting, rather than 200 spiciness being default.

You can access your scores at: http://wkscripts.nfshost.com/

Keep your API-key ready.

I couldn’t get it to work in Safari on iOS, but it works in Google Chrome, even on iOS. If someone has any idea how I can fix it in Safari, I’ll gladly take their advice.

Gotcha. Another question - what exactly does the spiciness level try to calculate?

Spiciness roughly corresponds to the number showed in the box called “Next day” on your frontpage, so long as you do your lessons and reviews regularly.

This is not always the case. What is the case though, is that more spiciness = more reviews, less spiciness = less reviews.

So just experiment with it. Try a spiciness setting for a while, and see if you like it. If you want to do more reviews every day, increase it by ten or so, if it’s still not enough, increase more. And decrease if you feel things are getting too spicy for you.

2 Likes

amazing idea !!! i burned out, still trying to deal with my big review pile so i stopped doing lessons for now, but downloading this one to manage my lessons when i’ll start doing them again.

sounds really promising to me !! just need to find a good value for the spiciness ^^
set it at 150 for now, and it prevent me to do review, which is good for me right now^^ but i’ll see if i need to change it later

1 Like

Hey, it works for me on Safari.

Do you have a content blocker installed?
I had to reload without content blockers to see the page.

Not sure to be honest, I just borrowed the iPhone. Well, if it works it works!