Skip to content

Conversation

rdearman
Copy link

@rdearman rdearman commented Apr 7, 2025

This PR introduces a yearly activity heatmap to the /stats page. It visualises user activity over the current year (e.g., 2025), based on the number of WoStatusChanged updates per day.

Features:

Visual heatmap using a calendar-style layout (similar to AnkiDroid)

Data is pulled from the existing words table, using WoStatusChanged dates

Only shows activity for the current calendar year, dynamically updated

Displays in UTC to ensure consistent date mapping across timezones

Includes a legend showing activity intensity levels

Notes:

Existing stats functionality is untouched (original /stats/data logic remains)

Heatmap rendering and endpoint are fully self-contained

Let me know if you'd like any changes or enhancements!

@jzohrab
Copy link
Collaborator

jzohrab commented Apr 11, 2025

Hi @rdearman - sorry for the delay in responding. Thanks for the PR!

A heatmap based on word status dates will be misleading, so I think it should be based on words read instead (which is the wordsread table, populated when the user clicks the icons at the bottom of each page) -- but that's already kind of implicit in the "words read" chart.

e.g., if I created a bunch of status 1 words yesterday while reading, but today I read more and don't create or update any new words, a heatmap based on word status dates would only show the items from the prior day, even though I read a bunch today. Another example: if I read 10 new words last week, and then updated their statuses again this week, the heatmap would only show the entries for this week, and nothing for last week.

I think that to do a word-status-based heatmap correctly, Lute would need to track the status history of words, and not just track the current status. The idea of tracking status history was mentioned in issue "Add word stats breakdown", and then maybe this work could be combined with that.

Thoughts?

Cheers and thanks again for taking the time with this submission!

@jzohrab jzohrab added this to Lute-v3 Apr 11, 2025
@jzohrab jzohrab moved this to In Progress in Lute-v3 Apr 11, 2025
@jzohrab jzohrab added the question Further information is requested label Apr 11, 2025
@rdearman
Copy link
Author

I looked at that. But I am looking at it more like an anki heat map which would show me that I have consistently been using it every day. The problem with words read is that it is only updated when you move to the next page. For me learning Korean I am only reading about 3 sentences a week and it is going to take ages before wordsread gets updated. So while perhaps more accurate it is less motivating. I did consider putting in an activity table and creating a trigger to show when you were active on that day. Might need to rethink it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants