Skip to content

Fix status filtering & persistence bugs, add search filter - #31

Open
moldscraper23-lab wants to merge 1 commit into
pavlinhristov:mainfrom
moldscraper23-lab:codex/lab-fixes
Open

Fix status filtering & persistence bugs, add search filter#31
moldscraper23-lab wants to merge 1 commit into
pavlinhristov:mainfrom
moldscraper23-lab:codex/lab-fixes

Conversation

@moldscraper23-lab

Copy link
Copy Markdown

Here is a clear, review-ready Pull Request description template tailored to the changes made in this lab. You can copy and paste this directly into GitHub when opening your PR:

🚀 Title
Fix task filtering & persistence bugs, add case-insensitive search

📝 Summary of Changes
This PR addresses two existing bugs in the FastAPI application and adds a requested search feature for the /tasks endpoint.

🐛 Bug Fixes
Status Filtering (GET /tasks?status=...): Fixed issue where the status query parameter was not properly filtering tasks. Updated logic to filter results by matching status (open / done).

Task Completion Persistence (POST /tasks/{id}/complete): Fixed issue where completing a task modified state in-memory without persisting. Updated the handler to record completed_at timestamp and call store.save_tasks() to persist state to data/tasks.json.

✨ New Features
Task Search (GET /tasks?q=...): Added an optional q query parameter to support case-insensitive matching across task title and description.

Filter Composition: Ensured q and status query parameters compose smoothly together (e.g., GET /tasks?status=open&q=plan).

🧪 Verification & Testing
Tested locally via curl requests against running uvicorn instance:

Bash

1. Status Filter

curl "http://127.0.0.1:8000/tasks?status=open"

2. Persistence Check

curl -X POST "http://127.0.0.1:8000/tasks/3/complete"
curl "http://127.0.0.1:8000/tasks/3"

3. Search Matching

curl "http://127.0.0.1:8000/tasks?q=launch"

4. Composed Query

curl "http://127.0.0.1:8000/tasks?status=open&q=plan"
🧹 Clean Diff Check
Cleaned up runtime modifications to data/tasks.json so the PR contains only application code changes inside app/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants