Repository navigation
feat(waiter-calls): live waiting timer and attention times in analytics - #255
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Summary
Two additions to waiter calls.
1. Live waiting timer
On
/waiterand in the admin bell, each pending call now showsEsperando mm:ss, ticking every second. Before, the list said "recién" or "hace N min" and refreshed every 15 s.<time role="timer">element; itsdatetimeis the time the call was created.2. Attention times in Analíticas
A new "Llamados de mesa" panel uses the same local and period filter as the rest of the page. It shows:
New RPC
get_waiter_call_stats(p_tenant_id, p_from, p_to)indatabase/create-waiter-call-stats.sql:get_analytics. The caller's RLS (waiter_calls_staff_select) still scopes the rows.get_analytics: onlytenant_admin(own local) andsuper_admin(any local, orNULLfor all locals) may call it.resolved_at - created_atofattendedcalls.resolved_atandresolved_byare already stamped server-side by the existing trigger, so the data is there for past calls too.pendingcalls already pastexpires_atthat no newer call has swept yet.waiter_calls_tenant_created_idx (tenant_id, created_at)./api/admin/users, becauseadmin_usersis not readable from the browser. A user who is unknown or was deleted shows as "Sin identificar". If the names fail to load, the times still show.Deploy
Run
database/create-waiter-call-stats.sqlin the Supabase SQL Editor. It has no psql meta-commands and can be re-run.Rollback:
database/rollback-create-waiter-call-stats.sql(calls are kept).Until the SQL is applied, the panel shows "No se pudieron cargar los llamados de mesa." and the rest of Analíticas keeps working.
Verification
useWaiterCallswaiterCallStats.test.jsx(7 tests)expires_atcount as expired, and calls outside the range are excluded.resolved_bygetsstaff_idnull.forbidden. Waiter:forbidden. Anon:permission denied. Inverted range:invalid_range. Super admin: all locals or a single one.npm run test:run: 622 passed;npm run lintclean;npm run buildOK.Risk: item 2 (a new RPC callable by
authenticated; its role and tenant checks were proven in the lab).🤖 Generated with Claude Code