[Issue]: Dashboard PO count shows wrong number #41
Labels
No labels
bug
claude-failed
claude-pr
claude-queue
claude-working
feature
interactive
portal
triaged
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: shad0w/pelagia-portal#41
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Description
The 'Total Purchase Orders' card on the dashboard shows a number that does not match the actual count of POs. It looks like a counting bug.
Claude triage
Triage — Issue #41: Dashboard PO count shows wrong number
Summary
The "Total Purchase Orders" card on the dashboard reportedly shows a number that
doesn't match the actual count of POs ("a counting bug"). Investigation shows the
underlying count query is already correct, so the report is either a perception
mismatch or an unstated expectation. There is no reproduction, no role, and no
expected-vs-actual numbers — the defect cannot be pinned down or verified without
clarification from the reporter.
Where the card lives
app/(portal)/dashboard/page.tsx:263, insideGenericDashboard.GenericDashboardrenders for roles other than TECHNICAL / MANNING /SUPERUSER / MANAGER / ACCOUNTS — i.e. AUDITOR and ADMIN (
page.tsx:13-29).const total = await db.purchaseOrder.count();(page.tsx:258)— an unfiltered count of every PurchaseOrder row, which is the correct figure
for something labelled "Total".
/history(href="/history").What I checked
prisma/schema.prisma,model PurchaseOrder): nodeletedAt/soft-delete / archived flag, so
count()has no rows it ought to be excluding —the unfiltered count is genuinely "all POs".
/history(app/(portal)/history/page.tsx): the listing query is capped attake: 200(line 64) and is gated behind theexport_reportspermission. Withprod-like data (staging mirrors production), there may be more than 200 POs, so
a user who clicks the card and counts the visible rows will see 200 while the card
shows the true total — a likely source of the perceived mismatch, but not a bug in
the card itself.
Open Orders,Pending Approval,Completed Orders, etc.) use deliberate status filters; none is labelled "TotalPurchase Orders".
Action items (pending clarification)
AUDITOR/ADMIN) and capture the displayed number vs the "actual count" they compared
against.
/historylist the card links to./historytake: 200cap, decide on the desired remedy(show a total-results count on history, paginate, or relink the card) — a larger
product/UX decision, not a one-line count fix.
Files / areas involved
app/(portal)/dashboard/page.tsx(GenericDashboard, line 258/263) — primary.app/(portal)/history/page.tsx(200-row cap, line 64) — likely related to theperceived discrepancy.
components/dashboard/stat-card.tsx— presentation only; no defect.Open questions
/historylist?Routing rationale: The literal code (
db.purchaseOrder.count()) is already correct and the report lacks any reproduction, role, or numbers, so there is no clear, test-verifiable defect to fix — it needs human clarification of the expected count, making this interactive rather than claude-queue.Routing:
interactive| Type:bug