diff --git a/ondeck/src/app/(dashboard)/dashboard/page.tsx b/ondeck/src/app/(dashboard)/dashboard/page.tsx
index 32b9a9a..170b0a4 100644
--- a/ondeck/src/app/(dashboard)/dashboard/page.tsx
+++ b/ondeck/src/app/(dashboard)/dashboard/page.tsx
@@ -14,15 +14,18 @@ export default async function DashboardPage() {
redirect('/auth/signin')
}
- // Fetch real statistics
- const [clientCount, policyCount, taskCount] = await Promise.all([
- prisma.client.count(),
- prisma.policy.count(),
- prisma.task.count({ where: { status: { not: 'COMPLETED' } } }),
+ // Fetch real statistics — scoped to Shape clients only
+ const shapeWhere = { designation: { name: { in: ['Shape', 'Shape 2'] } } }
+ const shapeClientIds = (await prisma.client.findMany({ where: shapeWhere, select: { id: true } })).map((c) => c.id)
+
+ const [clientCount, policyCount, taskCount, completedTasks, totalTasks] = await Promise.all([
+ prisma.client.count({ where: shapeWhere }),
+ prisma.policy.count({ where: { clientId: { in: shapeClientIds }, status: { notIn: ['Cancelled', 'Expired', 'Non-Renewed', 'Rewritten', 'Not taken'] } } }),
+ prisma.task.count({ where: { clientId: { in: shapeClientIds }, status: { notIn: ['COMPLETED', 'CANCELLED', 'NA'] } } }),
+ prisma.task.count({ where: { clientId: { in: shapeClientIds }, status: 'COMPLETED' } }),
+ prisma.task.count({ where: { clientId: { in: shapeClientIds }, status: { notIn: ['CANCELLED', 'NA'] } } }),
])
- const completedTasks = await prisma.task.count({ where: { status: 'COMPLETED' } })
- const totalTasks = await prisma.task.count()
const completionRate = totalTasks > 0 ? Math.round((completedTasks / totalTasks) * 100) : 0
return (
@@ -47,7 +50,7 @@ export default async function DashboardPage() {
{clientCount}
- Active client accounts
+ Shape program clients
@@ -60,7 +63,7 @@ export default async function DashboardPage() {
{policyCount}
- Policies requiring renewal
+ Active Shape policies
@@ -73,7 +76,7 @@ export default async function DashboardPage() {
{taskCount}
- Tasks awaiting completion
+ Open tasks (excludes NA/cancelled)
@@ -86,7 +89,7 @@ export default async function DashboardPage() {
{completionRate}%
- Tasks completed on time
+ Tasks completed vs total