Fix stats: count kontaktiert via tag instead of status field
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user