Skip to content

Create add point#25

Merged
YuriiBerezan merged 7 commits intomainfrom
create_add_point
Apr 29, 2025
Merged

Create add point#25
YuriiBerezan merged 7 commits intomainfrom
create_add_point

Conversation

@YuriiBerezan
Copy link
Copy Markdown
Owner

add in frontend:
dropdown list;
validation;

add in backend:
endpoint for status;

@YuriiBerezan YuriiBerezan merged commit 5e55f6a into main Apr 29, 2025
2 checks passed
@YuriiBerezan YuriiBerezan deleted the create_add_point branch April 29, 2025 19:45
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 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)
Copy link

Copilot AI Apr 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copilot uses AI. Check for mistakes.
<Item name="description" label="Description">
<TextArea rows={3} placeholder="Enter task description" />
</Item>
{task && ( // Only show status field if task is provided (for editing)
Copy link

Copilot AI Apr 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
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.

3 participants