-
Notifications
You must be signed in to change notification settings - Fork 90
Implementation of Filter Functionality for Dog Breeds and Adoption Availability #125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Akiri017 <[email protected]>
Implement search and filter functionality for dog breeds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements filter functionality for dog breeds and adoption availability on the dog listing page. Users can now filter dogs by breed using a dropdown and show only available dogs using a checkbox. The implementation includes both frontend filtering controls and backend API support for the filtering parameters.
- Added breed and availability filter query parameters to the
/api/dogs
endpoint - Created a new
/api/breeds
endpoint to populate the breed dropdown - Enhanced the dog listing UI with filter controls and adoption status badges
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
server/app.py | Added filtering logic to dogs endpoint and new breeds endpoint |
server/test_app.py | Updated tests to include status field and added new filter test cases |
client/src/components/DogList.svelte | Added filter UI controls and status badges for dogs |
.vscode/launch.json | Added VS Code debug configuration |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
dog.status = MagicMock() | ||
dog.status.name = status |
Copilot
AI
Sep 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mock setup creates a nested MagicMock for the status attribute. This could be simplified by directly setting dog.status.name = status
without the intermediate MagicMock assignment, or by using a more explicit mock setup that clearly represents the enum structure.
Copilot uses AI. Check for mistakes.
$: if (selectedBreed !== undefined && availableOnly !== undefined) { | ||
fetchDogs(); | ||
} |
Copilot
AI
Sep 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reactive statement will trigger fetchDogs()
on component initialization when both variables are defined, causing an unnecessary duplicate API call since fetchDogs()
is already called in onMount()
. Consider checking if the component has been mounted or if the values have actually changed from their initial state.
Copilot uses AI. Check for mistakes.
|
||
# Apply availability filter if requested | ||
if available_only: | ||
from server.models.dog import AdoptionStatus |
Copilot
AI
Sep 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The import statement is inside the function scope. For better maintainability and performance, consider moving this import to the top of the file with the other imports.
Copilot uses AI. Check for mistakes.
Added a breed filter dropdown and an "Available Dogs Only" checkbox to the dog listing page, allowing users to easily filter dogs by breed and adoption status. Each dog now displays an "Adopted" or "Available" tag next to its name and breed, making it simple to identify their current status at a glance.