From 342b5a47bef10f48a0acf8dee910db581d5faac5 Mon Sep 17 00:00:00 2001 From: Aimie Date: Mon, 20 Jul 2026 17:24:34 +0100 Subject: [PATCH] Fix task bugs and add search filter --- app/service.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/service.py b/app/service.py index 8022b93..eb46df1 100644 --- a/app/service.py +++ b/app/service.py @@ -12,13 +12,14 @@ def list_tasks(status: str | None = None, q: str | None = None) -> list[dict[str filtered: list[dict[str, Any]] = [] for task in tasks: - # Instructor note: intentional bug for the lab. - # This uses the literal string "status" instead of the query parameter value. - if status and task["status"] != "status": + if status and task["status"] != status: continue - # Instructor note: partial feature for the lab. - # The route already accepts `q`, but search is not implemented yet. + if q: + search_text = f'{task["title"]} {task["description"]}'.casefold() + if q.casefold() not in search_text: + continue + filtered.append(task) return filtered