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