feat: add registered user stats to ActivityStats via pseudo_user - #19
Draft
Amund-Fremming with Copilot wants to merge 1 commit into
Draft
feat: add registered user stats to ActivityStats via pseudo_user#19Amund-Fremming with Copilot wants to merge 1 commit into
Amund-Fremming with Copilot wants to merge 1 commit into
Conversation
…ser JOIN base_user Agent-Logs-Url: https://github.com/Amund-Fremming/tero.platform/sessions/b2a8084d-3956-446a-a5fe-964cf2e797e6 Co-authored-by: Amund-Fremming <114174150+Amund-Fremming@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
Amund-Fremming
May 1, 2026 13:46
View session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
/activity-statsendpoint had no way to count newly registered users per day/week/month — only active users. Counting directly frombase_useralongsidepseudo_useractive-user stats would cause double-counting for registered users.Changes
models/user.rs— NewRegisteredUserStatsstruct (todays_registered,this_week_registered,this_month_registered); addedregistered: RegisteredUserStatsfield toActivityStatsdb/user.rs— New concurrentregistered_futquery usingpseudo_user JOIN base_userfiltered bybase_user.created_at; result joined into the existingtokio::join!block.sqlx/— Added offline query cache file for the new queryHow double-counting is avoided
Each registered user has exactly one
pseudo_userrow (withbase_user_idset). By driving the count frompseudo_userside via JOIN, every registered user appears exactly once regardless of what else queriesbase_user:The existing
RecentUserStats(active users bylast_active) is unchanged — it already only touchespseudo_user.