PhoenixKit 2.14.1: Dashboard numbers you can click, and counted right
PhoenixKit 2.14.1 turns every number on the admin dashboard into a link to the list behind it, and fixes two counts that were wrong and a misleading label.
Unique Users counted session rows, not people, so it always equalled Active Sessions. It now counts people. Today’s Sessions started the day at midnight UTC instead of in the site’s time zone, so on a site east of UTC late sign-ins fell into the day before. The Active Sessions card now reads Unexpired sign-ins, not live connections, since it counts every valid sign-in on every device over 60 days.
To make the links useful, /admin/users gets two filters, by status and by email confirmation, and /admin/users/sessions gets a Show: selector with Active sessions, Started today and Expired.
Time zone offsets for named zones such as Europe/Warsaw were read as zero, so code that used them computed in UTC. They now give the real offset, which also corrects the availability windows in Bookings and the day window in Calendar, both off by the site’s offset until now.
Full release notes: PhoenixKit 2.14.1
2.14.1 · 5 September 2026
Fixes found by running 2.14.0 against a real install: a dashboard statistic that could only ever report the wrong number, two timezone consumers left behind when the picker moved to IANA identifiers, and every statistic on the dashboard becoming a link to the list behind it.
Added
-
TimeZone.offset_seconds/2andTimeZone.day_start/2. The first gives the offset for either kind of stored value — a legacy"2"or an IANA id resolved at an instant, sinceEurope/Warsawhas no single answer. The second gives the UTC instant at which the current day began somewhere, for “how many X today” where today is the operator’s day. Both are what the two fixes below needed and neither had. -
Every number on the admin dashboard is now a link to the report behind it. A statistic you cannot drill into is a dead end: seeing “29 Active Sessions” and having no way to ask which 29 is what sent one operator to the Live Sessions page to reconcile it by hand. All sixteen cards across Platform Statistics, Active Sessions, Real-Time Activity and the user-status row now navigate to a filtered list.
Five of them had no report to point at, so the filters came first rather than linking at a list that could not contain the counted rows:
Auth.list_users_paginated/1gains:status(active/inactive) and:confirmation(confirmed/pending), deep-linkable as?status=and?confirmation=and surfaced as two dropdowns on/admin/users— a filter with no visible control would leave a visitor arriving from a card looking at a filtered list with nothing on screen saying why.Sessions.list_active_sessions/1takes a scope —:active(the default, so existing callers are unchanged),:todayand:expired— deep-linkable as?scope=with a matching selector on/admin/users/sessions.
The predicates are deliberately identical to the ones
Roles.get_extended_stats/0andSessions.get_session_stats/0count with, and a test file asserts each card’s number against its own link’s result rather than either in isolation. Unknown values (?status=nonsensefrom a hand-edited URL) fall back to unfiltered rather than to an empty list, which would read as “you have no users”.StatCardandHeroStatCardgain an optionalnavigateattr; without it they render exactly as before.
Fixed
-
“Unique Users” counted session rows, not people.
get_session_stats/0asked forRepo.aggregate(query, :count, :user_uuid, distinct: true), butaggregate/4’s last argument is REPO options —:prefix,:timeout— andEcto.Repo.Queryable.query_for_aggregate/3builds the select from the field alone and never sees them.distinct: truewas accepted and silently ignored, so the card reported one “unique user” per session row and was equal to “Active Sessions” by construction. Reported from a live install showing 29 unique users against 2 registered accounts. -
“Active Sessions / Currently logged in” invited exactly that confusion. The number counts session tokens inside the 60-day validity window across every device, so one person who has signed in 29 times over two months is 29 — while the Live Sessions page, which reads Presence, correctly showed one. The subtitle now reads “Unexpired sign-ins, not live connections”.
-
“Today’s Sessions” counted UTC’s day, not the operator’s.
get_session_stats/0took midnight fromDateTime.utc_now()and ignored thetime_zonesetting entirely, so on any site east of UTC every sign-in after 21:00 local (UTC+3) fell into “yesterday” — the card read 0 while somebody was signed in. Both it and the new:todaysession scope now start the day in the configured zone. -
Utils.Date.offset_to_seconds/1returned 0 for every named timezone. It wasFloat.parse/1, which cannot read"Europe/Warsaw"— and since the timezone picker moved to IANA ids, that is what the setting holds on any site that has touched it. Every caller was therefore computing in UTC without saying so. It now delegates to the newTimeZone.offset_seconds/2.⚠️ This one reaches outside core. Three call sites in module packages take that number as gospel and were silently off by the site’s whole offset:
phoenix_kit_bookings’site_offset_seconds/0(availability windows),phoenix_kit_calendar’swindow_bounds/3(timed events near midnight fall out of the day the grid puts them in) and itstz_differs?/2(two different named zones compared equal, so “show in their timezone” saw no difference). The first two are corrected by this delegation;tz_differs?/2should move toTimeZone.effectively_same?/2, which answers the question it is actually asking.
PhoenixKit 2.14.1. Install or update: {:phoenix_kit, "~> 2.14"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.