diff --git a/app/api/leads/stats/route.ts b/app/api/leads/stats/route.ts index 33e43ae..00d9fbf 100644 --- a/app/api/leads/stats/route.ts +++ b/app/api/leads/stats/route.ts @@ -3,12 +3,12 @@ import { prisma } from "@/lib/db"; export async function GET() { try { - const [total, newLeads, contacted, withEmail] = await Promise.all([ + const [total, contacted, withEmail] = await Promise.all([ prisma.lead.count(), - prisma.lead.count({ where: { status: "new" } }), - prisma.lead.count({ where: { status: { in: ["contacted", "in_progress"] } } }), + prisma.lead.count({ where: { tags: { contains: "kontaktiert" } } }), prisma.lead.count({ where: { email: { not: null } } }), ]); + const newLeads = total - contacted; // Daily counts for last 7 days const sevenDaysAgo = new Date();