Merged
Conversation
…and update related components to use dynamic status options.
…fetch statuses from backend
…ance error handling
ViktorDronov
approved these changes
Apr 29, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces new task status functionality in both frontend and backend.
- Frontend: Adds a status field to task types, updates the task management component to handle status, and integrates a status selection dropdown in the edit dialog.
- Backend: Provides a new endpoint for retrieving task statuses and updates the task model to validate status based on a defined set.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend_app/src/components/TaskManager/types.ts | Extended task interface with a status property |
| frontend_app/src/components/TaskManager/index.tsx | Updated task management logic to include status handling and duplicate check |
| frontend_app/src/components/TaskManager/api/useTasks.tsx | Added state and API call for fetching task statuses |
| frontend_app/src/components/TaskManager/AddOrEditDialog.tsx | Added status dropdown in the edit dialog |
| backend_app/src/statutes.py | Introduced a STATUSES constant |
| backend_app/src/routers/v1/tasks.py | Added endpoint to retrieve task statuses |
| backend_app/src/models.py | Updated task model to use STATUSES pattern for status validation |
Comments suppressed due to low confidence (1)
backend_app/src/statutes.py:1
- [nitpick] The file name 'statutes.py' may be misleading; consider renaming it to 'statuses.py' to better reflect its content.
STATUSES= ["pending", "in_progress", "completed", "archived"]
Comment on lines
+79
to
+82
| const isDuplicate = tasks.some((task) => | ||
| normalize(task.title) === normalize(newTask.title) && | ||
| normalize(task.description) === normalize(newTask.description) && | ||
| (task.status === newTask.status || newTask.status === undefined) |
There was a problem hiding this comment.
The duplicate check condition may inadvertently flag new tasks with an undefined status as duplicates; consider providing a default status or revising the condition.
Suggested change
| const isDuplicate = tasks.some((task) => | |
| normalize(task.title) === normalize(newTask.title) && | |
| normalize(task.description) === normalize(newTask.description) && | |
| (task.status === newTask.status || newTask.status === undefined) | |
| const normalizeStatus = (status?: string) => (status ?? 'undefined').toLowerCase(); | |
| const isDuplicate = tasks.some((task) => | |
| normalize(task.title) === normalize(newTask.title) && | |
| normalize(task.description) === normalize(newTask.description) && | |
| normalizeStatus(task.status) === normalizeStatus(newTask.status) |
| <Item name="description" label="Description"> | ||
| <TextArea rows={3} placeholder="Enter task description" /> | ||
| </Item> | ||
| {task && ( // Only show status field if task is provided (for editing) |
There was a problem hiding this comment.
Since the status dropdown is only rendered for editing tasks, new tasks may not have a status set; either always display the status field or ensure a default status is assigned when creating new tasks.
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.
add in frontend:
dropdown list;
validation;
add in backend:
endpoint for status;