Skip to content

London | 26-ITP-Sep | Bartosz Kawiak | Sprint 3 | Todo list - #1559

Open
bartoszkawiak wants to merge 2 commits into
CodeYourFuture:mainfrom
bartoszkawiak:todo-list
Open

bartoszkawiak wants to merge 2 commits into
CodeYourFuture:mainfrom
bartoszkawiak:todo-list

Conversation

@bartoszkawiak

Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Task code

CYF-1097

Changelist

I added a Delete all completed tasks button, tested it in Jest and made sure it works in a browser.

@bartoszkawiak bartoszkawiak added 📅 Sprint 3 Assigned during Sprint 3 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Data-Groups The name of the module. labels Nov 20, 2026
@cyf-ai-code-reviewer

Copy link
Copy Markdown

The CYF AI reviewer checked this PR did not find any obvious problems. Please wait for a volunteer to also have a look and offer their own feedback.

@hackertainment hackertainment added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Nov 21, 2026

@hackertainment hackertainment left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

There are code changes related to tidy up code, which make the PR a bit hard to read and it took me quite a while to figure out which lines are actually related to the new logic. This program runs correctly. Just need to add the missing test cases and answer a question. Thank you.

Comment on lines +31 to +34
export function deleteCompleted(todoList) {
const remainingTodos = todoList.filter((todo) => !todo.completed);
todoList.splice(0, todoList.length, ...remainingTodos);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

While this is correct, just wondering whether there is any reasons or advantages for choosing this approach over other implementations? Please explain a bit your design considerations. Thank you very much.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I chose filter() because it makes it easy to keep only incomplete tasks without manually looping through the array. I then used splice() to update the original array, keeping it consistent with the other functions in todos.mjs.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

How about deleting tasks from a list with all tasks incomplete and from an empty list? Please add those test cases as well. Thank you.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thank you, I added both missing test cases and all the test passed.

@hackertainment hackertainment added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Nov 21, 2026
@bartoszkawiak bartoszkawiak added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Data-Groups The name of the module. Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Reviewed Volunteer to add when completing a review with trainee action still to take. 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants