Skip to content

Filter activity stats to count only unregistered pseudo users - #18

Draft
Amund-Fremming with Copilot wants to merge 1 commit into
mainfrom
copilot/oppdater-api-brukertelling
Draft

Filter activity stats to count only unregistered pseudo users#18
Amund-Fremming with Copilot wants to merge 1 commit into
mainfrom
copilot/oppdater-api-brukertelling

Conversation

Copilot AI commented May 1, 2026

Copy link
Copy Markdown
Contributor

Activity stats (today/week/month counts, rolling averages, total) were counting all pseudo_user rows — including those linked to a base_user (i.e., registered accounts). Stats should only reflect anonymous/guest users (base_user_id IS NULL).

Changes

  • src/db/user.rs — Added WHERE base_user_id IS NULL (or AND base_user_id IS NULL in subqueries) to all three stat queries in get_user_activity_stats:
    • Recent counts: todays_users, this_week_users, this_month_users
    • Rolling averages: avg_daily_users, avg_week_users, avg_month_users
    • Total user count
  • .sqlx/ — Replaced the three affected offline query cache files with new hashes matching the updated SQL
-- Before
SELECT COUNT(*) FILTER (...) FROM pseudo_user

-- After
SELECT COUNT(*) FILTER (...) FROM pseudo_user WHERE base_user_id IS NULL

…_id IS NULL)

Agent-Logs-Url: https://github.com/Amund-Fremming/tero.platform/sessions/253c1ff7-d19f-462a-aeb5-2d33f08750c4

Co-authored-by: Amund-Fremming <114174150+Amund-Fremming@users.noreply.github.com>
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.

2 participants