Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

Task count to exclude completed & cancelled tasks

Khuram Niaz63734f6fd557
diff --git a/__tests__/TasksPageClient.spec.tsx b/__tests__/TasksPageClient.spec.tsx
index a512fa1..072e446 100644
--- a/__tests__/TasksPageClient.spec.tsx
+++ b/__tests__/TasksPageClient.spec.tsx
@@ -334,7 +334,7 @@ describe("TasksPageClient Component", () => {
/>
);
- const sidebar = container.querySelector(".w-48.border-r.p-4");
+ const sidebar = container.querySelector(".w-48.border-r.py-4");
expect(sidebar).toBeInTheDocument();
});
diff --git a/__tests__/task.actions.spec.ts b/__tests__/task.actions.spec.ts
index 02ba723..143f62d 100644
--- a/__tests__/task.actions.spec.ts
+++ b/__tests__/task.actions.spec.ts
@@ -782,12 +782,21 @@ describe("taskActions", () => {
},
include: {
_count: {
- select: { Tasks: true },
+ select: {
+ Tasks: {
+ where: {
+ status: { notIn: ["complete", "cancelled"] },
+ },
+ },
+ },
},
},
});
expect(prisma.task.count).toHaveBeenCalledWith({
- where: { userId: mockUser.id },
+ where: {
+ userId: mockUser.id,
+ status: { notIn: ["complete", "cancelled"] },
+ },
});
});
diff --git a/src/actions/task.actions.ts b/src/actions/task.actions.ts
index e476303..892df56 100644
--- a/src/actions/task.actions.ts
+++ b/src/actions/task.actions.ts
@@ -344,13 +344,21 @@ export const getActivityTypesWithTaskCounts = async (): Promise<
throw new Error("Not authenticated");
}
+ const excludedStatuses = ["complete", "cancelled"];
+
const activityTypes = await prisma.activityType.findMany({
where: {
createdBy: user.id,
},
include: {
_count: {
- select: { Tasks: true },
+ select: {
+ Tasks: {
+ where: {
+ status: { notIn: excludedStatuses },
+ },
+ },
+ },
},
},
});
@@ -363,7 +371,10 @@ export const getActivityTypesWithTaskCounts = async (): Promise<
}));
const totalTasks = await prisma.task.count({
- where: { userId: user.id },
+ where: {
+ userId: user.id,
+ status: { notIn: excludedStatuses },
+ },
});
return { success: true, data, totalTasks };
diff --git a/src/components/tasks/TasksSidebar.tsx b/src/components/tasks/TasksSidebar.tsx
index 0fc489c..272fe2e 100644
--- a/src/components/tasks/TasksSidebar.tsx
+++ b/src/components/tasks/TasksSidebar.tsx
@@ -22,7 +22,7 @@ function TasksSidebar({
onFilterChange,
}: TasksSidebarProps) {
return (
- <div className="w-48 border-r p-4 hidden md:block h-full">
+ <div className="w-48 border-r py-4 hidden md:block h-full">
<h3 className="font-semibold mb-4 text-sm">Activity Types</h3>
<ul className="space-y-1">
<li>
@@ -36,7 +36,9 @@ function TasksSidebar({
>
<span className="flex justify-between items-center">
<span>All</span>
- <span className="text-muted-foreground text-xs">{totalTasks}</span>
+ <span className="text-muted-foreground text-xs">
+ {totalTasks}
+ </span>
</span>
</button>
</li>
@@ -47,12 +49,15 @@ function TasksSidebar({
className={cn(
"w-full text-left px-3 py-2 rounded-md text-sm transition-colors",
"hover:bg-accent hover:text-accent-foreground",
- selectedFilter === type.id && "bg-accent text-accent-foreground font-medium"
+ selectedFilter === type.id &&
+ "bg-accent text-accent-foreground font-medium"
)}
>
<span className="flex justify-between items-center">
<span className="truncate">{type.label}</span>
- <span className="text-muted-foreground text-xs">{type.taskCount}</span>
+ <span className="text-muted-foreground text-xs">
+ {type.taskCount}
+ </span>
</span>
</button>
</li>