I’ve wracked my feeble, noob brain trying to get my userscript to grab the total number of Kanji and Vocab for the current level. Currently my script only grabs the unlocked count.
I’ve added the “srs: [‘locked’]” tag to filters in hopes for it to output only the locked kanji/vocab then add it to the unlocked count, but it returns 0.
I feel like this should be a simple task, but it alludes me. Any help would be appreciated, thanks!
Your “Better Progress Bar”, laid the groundwork for what I’m trying to do, so thank you thank you!
I’d hope it’s not the function cause it’s yours XD
I do have a yearly subscription, this is actually what made me find the bug, I leveled up and instead of it showing 0 out of (max number of kanji) it showed 0 out of 14 (which was the unlocked kanji.
I got it! WOooo! It wasn’t an issue with the call function but rather with the function after it!
It was an issue with calling the variable that’s mapped to the completed kanji/vocab.
You may recall:
function handle_items(items) {
let srsStages = items.filter(item => item.assignments !== undefined)
.map(item =>
item.assignments.passed_at !== null
? 5
: Math.min(item.assignments.srs_stage, 5));
if (srsStages.length < 0) {
return 0;
}
let max = srsStages.length * 5;
let actual = srsStages.reduce((sum, x) => sum + x, 0);
The issue was with “max”, it needs to be items.length, not srsStages.length. (at least for what I’m trying to do).