Count a person's devices once, not once per organisation #263
No reviewers
Labels
No labels
area:docs
area:identity
area:ops
area:plugin
area:server
channel:community
channel:direct
channel:owned
channel:press
channel:social
e2ee-constrained
gate:at-ga
gate:pre-ga
marketing
parity
relay:absent
relay:planned
relay:requested
relay:supported
risk:additive
risk:contract
risk:none
usability
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Nectenda/nectenda!263
Loading…
Reference in a new issue
No description provided.
Delete branch "worktree-kpi-devices"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Task: NEC-223
The KPI leaderboard showed a paying customer with 6 active devices when they have 2, a Windows desktop and an Android phone, because they're in three organisations.
Why
usersrow), and each seat has its owndevicesrows.Fix
/api/kpi: each seat now carriesdeviceIdsandactiveDeviceIds30d, as sha256 truncated to 16 hex characters. The plugin's device id is per install (getOrCreateDeviceId), so the same install gives the same value in every organisation.v_person_devicescounts distinct ids per person, and all three places use it.Verified
pnpm test, typecheck, lint andbuild-dashboard --checkall pass.main's schema, with a person who has 2 devices in 3 organisations:sumback into the view reads 6 again.Changelog
NONE
🤖 Generated with Claude Code
https://claude.ai/code/session_01MY63BZ4UVtMHFcADNr1jFg
558502a542cba1d8bd98cba1d8bd98e50db43048e50db43048c9fce3a073