[Userscript] Wanikani Heatmap

Ah, interesting, maybe that’s what it is.
I just did my third session but the heatmap still says 60. As my session was just another block of 60, I have no idea if the heat map updated to reflect that session, or is still referring to the previous block. Maybe next time I’ll try doing, ooh I dunno, 61 or something. (I mean I don’t want to do anything too crazy or anything… )
But either way, it’s not showing a total for the current day right now. Maybe it’ll correct itself tomorrow.

4 Likes

Either i’m impossibly dedicated or something fishy is going on:

11 Likes

Wow, that is dedication!

2 Likes

26

Mine say I did 13 reviews yesterday… I did more LESSONS than that yesterday! :rofl:
I did at least over 100 reviews, (33 new lessons, most of it done in the morning and reviewed twice (so at least 50 reviews on those alone (not counting the review after lessons)) and had other reviews done as well, fairly divided during the day, much of it in the evening (but hasn’t been counted today either)

Not sure if it is just “slow” to update itself or if most of it didn’t register? And since it grabs the info the problem might be outside the program anyway =P

1 Like

I had a look at your code, because stats seem broken to me.
I didn’t figure out how to send you a private message so i just dump my findings here:

In store_data()
stored_data.counts[date.timestamp]++
the first entry in data will not initialize a key,val pair in stored_data.counts,
therefore the line above will set it to NaN, which gets JSON serialized to null, which then bugs out other stuff.

suggested fix:

if (initiate) {
    ...
    stored_data.counts[Date.parse(new Date(Date.parse(stored_data.first_date)).toDateString())/1000] = 0;
}

stored_data.current_streak and stored_data.studied_days should also be initiated to 1.
Reason: we already checked that data.length > 0 so we initialize stored_data with the first day already initialized

in calculate_stats()
var total_days = (Date.now()-Date.parse(data.first_date))/(24*60*60*1000);
should also be incremented by 1

After applying these fixes (and clearing my localstorage) my stats were correct.

Addition:

When the store_data is called on the same day again there is another bug:

When checking if the review is on a new day you compare the first entry with the date of the very first review ever, but you want to compare it against stored_data.last_date, because you filter the incoming data so the first entry of data will of course be a different day than the day of the very first review.

suggested fix:

var date = new Date(Date.parse(stored_data.last_date)).toDateString();

also initialize the last_date in stored_data:
last_date: data[0].data.created_at

fixed script: WK Heatmap 0.2.1 fix - Pastebin.com

4 Likes

You’ll be happy to know I’ve already fixed all of these for the next version, but thank you giving people an intermediary

3 Likes

Just wanted to let you know, we used to have it but they took it away due to abuse.
So there is no PM’s anymore =)

2 Likes

To unclarify: we didn’t have it, then we did, but now we don’t

4 Likes

I just wish @WaniMekani didn’t die in the process D=

5 Likes

Not sure if part of a fix already, but noticed something weird on the stats when comparing two screenshots taken 1 day apart;


482 days studied, jumped to 495
current streak of 43, jumped to 56

Not sure if it was a mistake that was fixed, or a mistake that happened :wink:

1 Like

there is a bug in the current version which does not count days correctly and other stuff

Kumirei already has a new version in the works which fixes it

while Kumirei is working on the next version you could use my fixed script:
https://pastebin.com/raw/z5CW6UhA

4 Likes

v.1.0.0

  1. Bugfixes
    • Stats should now be accurate and stay that way
    • No more compounding reviews on certain days
    • First day is saved properly
  2. Additions
    • Settings button right on the thing!
    • Most reviews done in a day as a tooltip
      image
    • Total reviews
      image
    • LESSONS Yes, this shows all your lessons, since these have always been logged.
    • Button to toggle between review and lesson heatmap
      image
    • Don’t forget the tooltip and total here too
      image
      image
    • Settings
      • A reset button that deletes your stored data. No more manually deleting local storage to replace incorrect data.
        image
      • Colors. You can now define each of the five colors individually. Go crazy
        image
      • Generate button. With a click you can have the script choose the three middle colors based on your start and end color.
        image
      • Interval settings. Choose your own intervals.
        image
19 Likes

If anything is not looking right please tell me. It was a big update and I probably messed up a few things.

2 Likes

@Abstormal, @merlumina, @jbradleyc

You might want to write down your colors before updating.

@jbradleyc Tell me if your streak is still janky after updating please

3 Likes

Just a warning for people who reset their level: all lessons from and above the level you reset to were “deleted” and moved to the time when you did those lessons last.

For example, I reached level 11 around 25 June, 2018. On 13 November 2018, after reaching level 21, I reset to level 11. All lessons between 25 June and 13 November are not available any more. Those lessons now appear on/after 13 November.

This is not a bug. WK does warn you when you reset that all your learned items are going to be purged from record and nobody can retrieve them again.

So don’t be alarmed if you see your lessons heatmap empty for several weeks/months.

3 Likes

Yeah, I don’t think WK saves previous dates for completed lessons

1 Like

I cant get the heat map to show up anymore. I tried changing the settings and that didn’t help either. This shows up though

Did you wait for the data to load? Are the heatmaps just not showing up?

Yea I tried deleting and reinstalling it also. I just leave that page open all the time and use other tabs for anything else so its not like I’m not giving it enough time to load. I have other scripts but it only shows that loading thing when the heat map is turned on.

Should take half a minute at most to load the data the first time. Could you check the console (F12 → console) for errors?