Skip to content

feat: add a study heatmap with daily activity and streaks - #72

Closed
Punnawit9285 wants to merge 8 commits into
masterfrom
heatmap
Closed

Punnawit9285 wants to merge 8 commits into
masterfrom
heatmap

Conversation

@Punnawit9285

Copy link
Copy Markdown
Member

Needs docchula/FlickMan#23 for syncing across devices

  • Heatmap: shows 3 months, 6 months, a year (default) or all time, with a short guide explaining it like the ones in Pomodoro.

  • Off by default (Can be turn on in settings menu)

  • Low server load:

    • The settings document is read at most once every 5 minutes.
    • Study time is sent at most once every 30 minutes per device, so at most 48 writes a day.
  • UI already test by clicking through in Safari's responsive design mode, both in Ipad and IOS, seem to work well so far (at least on localhost)

image image image

P.S. Pretty obvious where I got inspiration from haha
(GitHub and Anki heatmap addon)

Show a calendar of study activity on the home page, with per-day totals, current
and longest streaks, and a range selector. Time is credited from video playback
and from Pomodoro study phases, so both count towards the same picture.

Activity is recorded per device and merged across devices through
UserSyncService, which keeps an account's record in one document and re-reads it
at most once every five minutes so repeatedly opening the app does not multiply
billed reads. Video counts from other devices are kept as a separate total,
since devices do not share video identifiers and the lists cannot be combined
without double-counting. Sync sits behind a userSyncEnabled remote config flag.

The calendar colours come from --flick-* when a theme provides them and
otherwise fall back to values derived from the Ionic palette, so the heatmap
stands on its own and a theme can restyle it without either depending on the
other.
Study time is written at most once per 15 minutes per device. Leaving
the page no longer forces a write while the last one is recent; what is
held back stays on the device and is sent the next time the app opens.
The theme and the heatmap share one read, and hourly token refreshes no
longer spend another.

Also show the selected range on iOS, where the chosen segment is filled
with the same colour as its label, and bring today back into view when a
tablet is rotated.
The interval is remembered on the device, so reloading the page no
longer starts it again. That puts a hard ceiling of 48 study writes per
device per day; what is held back is still sent on the next open.
Master now runs the unit tests in CI, and every spec that created the
study tracker or the Pomodoro service failed here with "No provider for
Firestore", since the tracker syncs through UserSyncService. The
tracker's own tests get a stand-in sync service, and the Pomodoro's get
a stand-in tracker, so neither needs Firestore to run.
- observe Pomodoro timer observables from StudyStatsService to keep PomodoroService decoupled
- restore base PomodoroService and spec to master state
- update StudyStatsService spec with PomodoroService test provider
- re-anchor home page imports
- read and save the synced settings through FlickMan's v1/user_settings, so no Firestore rule is needed
- wait for the ID token before the first read, so sync is not switched off while sign-in finishes
- add getUserSettings and saveUserSettings to ManService
@ittipatken

Copy link
Copy Markdown
Member

I would like to raise a concern about the “streaks” feature. This website is different from a flashcard application, i.e. Anki, and is not designed to be used every day. The “streaks” and “heatmap” features may encourage users to watch the videos daily for rewards, potentially producing unhealthy usage habits. Therefore, I would actually advise against implementing these features. However, allowing users to turn them off could address this concern.

Ionic 9 (#74) dropped @ionic/angular/standalone, so the study
heatmap now imports from @ionic/angular like the rest of the app.
@keenthekeen

Copy link
Copy Markdown
Member

Replaced by f2c55fc.

I agree with @ittipatken that students aren't supposed to study recorded lectures every day. Furthermore, the activity data should be sourced from FlickMan's existing play_records.

@keenthekeen
keenthekeen deleted the heatmap branch October 10, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants