Skip to content

Commit fac2a9e

Browse files
committed
fix: TaskList open count should only include pending, not in_progress
1 parent fe5e245 commit fac2a9e

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

packages/code/src/components/TaskList.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,7 @@ export const TaskList: React.FC = () => {
133133
const inProgressCount = tasks.filter(
134134
(t) => t.status === "in_progress",
135135
).length;
136-
const openCount = tasks.filter(
137-
(t) => t.status === "pending" || t.status === "in_progress",
138-
).length;
136+
const openCount = tasks.filter((t) => t.status === "pending").length;
139137

140138
// Summary parts for hidden tasks
141139
const hiddenInProgress = hidden.filter(

packages/code/tests/components/TaskList.test.tsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,25 @@ describe("TaskList", () => {
9494
const { lastFrame } = render(<TaskList />);
9595
const output = lastFrame()!;
9696

97-
expect(output).toContain("4 tasks (2 done, 1 in progress, 2 open)");
97+
// "open" counts only pending tasks, not in_progress (no double-counting)
98+
expect(output).toContain("4 tasks (2 done, 1 in progress, 1 open)");
99+
});
100+
101+
it("should not double-count in_progress in open count", () => {
102+
const mockTasks: Task[] = [
103+
makeTask({ id: "1", subject: "Task 1", status: "in_progress" }),
104+
makeTask({ id: "2", subject: "Task 2", status: "in_progress" }),
105+
makeTask({ id: "3", subject: "Task 3", status: "pending" }),
106+
makeTask({ id: "4", subject: "Task 4", status: "completed" }),
107+
];
108+
vi.mocked(useTasks).mockReturnValue(mockTasks);
109+
110+
const { lastFrame } = render(<TaskList />);
111+
const output = lastFrame()!;
112+
113+
// open = pending only (1), not pending + in_progress (3)
114+
expect(output).toContain("4 tasks (1 done, 2 in progress, 1 open)");
115+
expect(output).not.toContain("3 open");
98116
});
99117

100118
it("should truncate long task subjects with wrap=truncate-end", () => {

0 commit comments

Comments
 (0)