Fix status filtering & persistence bugs, add search filter - #31
Open
moldscraper23-lab wants to merge 1 commit into
Open
Fix status filtering & persistence bugs, add search filter#31moldscraper23-lab wants to merge 1 commit into
moldscraper23-lab wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/.