Since the update earlier this year WK no longer knows the concept of a ‘review session’, which means there is no logical grouping of reviews into a session anymore. The time of the review still gives an indication (I don’t cache it, but the review cache script I rely on does!), but it’s not perfect. Two things to consider:
- a completed review is stored once both answers (for kanji and non-kana vocab) are correctly given. That means the review ’ session’ will have started before the first completed review. Say a user does 10 reviews as a ’ session’. The completion of the first review could be the user’s 2nd answer (when using a script like back to back), or it could be the user’s 11th answer (10 readings first, then the first of 10 meanings). So last review timestamp minus the first review timestamp could be the time for 18/20 answers, or it could be the time for 9/20 answers. Anywhere from 45%-90% of the review time (assuming constant rate of answering and giving only correct answers!).
- Some users will do a quick session with a few reviews, close the browser to do other things and come back 10 minutes later to do ‘another session’. Other users leave the browser open during a session to do others things and return to ‘their session’ 10 minutes later. So is the gap of 10 minutes between completed reviews a session break or isn’t it?
You can take a look at other scripts to see how they handle these issues
WaniKani Review Clock displays similar stats to what you’re looking at, but only during the reviews.
Ganbaro Meter displayed similar stats on the dashboard (which I think is what you’re looking for), but it uses the Get Reviews API which no longer returns any data and as such it is broken as a script. Probably still interesting to see how the script handled the ‘what is a session’ question.
The Heatmap also makes estimates on how much time a user spent doing reviews and counts the ‘number of review sessions’ a user has done (which is also an estimate - and I think based on configuration, so that a user can determine for themselves how long of an inactivity counts as a separate session).
To get more reliable numbers, I would probably look at a script that runs both during the reviews themselves (as a timer) and on the dashboard (to display results), but you’d need to account for typical ‘the user can do whatever’ situations like spontaneous browser closes.
This Review summary script mostly makes just 1 assumption - if you load the dashboard, your ‘session’ is over, and it displays everything since your last load of the dashboard. It does not work well when you have multiple browser windows open (reviews and dashboard!), and the only thing I added for that was a disclaimer (that it doesn’t work, lol).