From 7e215dd11cd0cf1f98629cd750d55f75c6ad367d Mon Sep 17 00:00:00 2001 From: smindlolennox-png Date: Tue, 17 Mar 2026 15:09:24 +0200 Subject: [PATCH 1/4] Update models.js Signed-off-by: smindlolennox-png --- use-cases/code-algorithms/javascript/TaskManager/models.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/use-cases/code-algorithms/javascript/TaskManager/models.js b/use-cases/code-algorithms/javascript/TaskManager/models.js index fb2c70d..fc4bd25 100644 --- a/use-cases/code-algorithms/javascript/TaskManager/models.js +++ b/use-cases/code-algorithms/javascript/TaskManager/models.js @@ -12,7 +12,8 @@ const TaskStatus = { TODO: 'todo', IN_PROGRESS: 'in_progress', REVIEW: 'review', - DONE: 'done' + DONE: 'done', + ABANDONED: 'abandoned' }; class Task { From dac695d9b8ef268e5177ac020c743a22d36b684e Mon Sep 17 00:00:00 2001 From: smindlolennox-png Date: Tue, 17 Mar 2026 15:13:25 +0200 Subject: [PATCH 2/4] Update app.js Signed-off-by: smindlolennox-png --- .../javascript/TaskManager/app.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/use-cases/code-algorithms/javascript/TaskManager/app.js b/use-cases/code-algorithms/javascript/TaskManager/app.js index b804733..696574b 100644 --- a/use-cases/code-algorithms/javascript/TaskManager/app.js +++ b/use-cases/code-algorithms/javascript/TaskManager/app.js @@ -150,4 +150,25 @@ class TaskManager { } } +markAbandonedTasks() { + const tasks = this.storage.getAllTasks(); + const now = new Date(); + + tasks.forEach(task => { + if (task.dueDate && task.status !== TaskStatus.DONE) { + const daysOverdue = Math.floor( + (now - task.dueDate) / (1000 * 60 * 60 * 24) + ); + const isHighPriority = + task.priority === TaskPriority.HIGH || + task.priority === TaskPriority.URGENT; + + if (daysOverdue > 7 && !isHighPriority) { + task.status = TaskStatus.ABANDONED; + } + } + }); + this.storage.save(); + } + module.exports = { TaskManager }; From 251812965ffda329baaa86fd1385a240e104db13 Mon Sep 17 00:00:00 2001 From: smindlolennox-png Date: Tue, 17 Mar 2026 15:22:04 +0200 Subject: [PATCH 3/4] Update cli.js Signed-off-by: smindlolennox-png --- .../javascript/TaskManager/cli.js | 58 ++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/use-cases/code-algorithms/javascript/TaskManager/cli.js b/use-cases/code-algorithms/javascript/TaskManager/cli.js index a6336b1..aa834b7 100644 --- a/use-cases/code-algorithms/javascript/TaskManager/cli.js +++ b/use-cases/code-algorithms/javascript/TaskManager/cli.js @@ -176,9 +176,65 @@ program console.log(`Completed in last 7 days: ${stats.completedLastWeek}`); }); +[15:14, 17/03/2026] Owen: program + .command('cleanup') + .description('Mark overdue tasks (7+ days) as abandoned') + .action(() => { + taskManager.markAbandonedTasks(); + console.log('Done. Tasks overdue by 7+ days have been marked as abandoned.'); + }); + +5. Scroll down → **"Commit changes"** + +--- + +### STEP 6 — Create a Pull Request +1. Click the **"Pull requests"** tab at the top +2. Click **"New pull request"** +3. Set **base:** `main` ← **compare:** `exercise/codebase-exploration` +4. Click **"Create pull request"** +5. Title it: `Exercise: Codebase Exploration & Abandoned Task Rule` +6. In the description paste: + +## What's in this PR +- exercise-findings.md — full codebase analysis findings +- models.js — added ABANDONED task status +- app.js — added markAbandonedTasks() business rule +- … +[15:16, 17/03/2026] Owen: program + .command('cleanup') + .description('Mark overdue tasks (7+ days) as abandoned') + .action(() => { + taskManager.markAbandonedTasks(); + console.log('Done. Tasks overdue by 7+ days have been marked as abandoned.'); + }); + +5. Scroll down → **"Commit changes"** + +--- + +### STEP 6 — Create a Pull Request +1. Click the **"Pull requests"** tab at the top +2. Click **"New pull request"** +3. Set **base:** `main` ← **compare:** `exercise/codebase-exploration` +4. Click **"Create pull request"** +5. Title it: `Exercise: Codebase Exploration & Abandoned Task Rule` +6. In the description paste: + +## What's in this PR +- exercise-findings.md — full codebase analysis findings +- models.js — added ABANDONED task status +- app.js — added markAbandonedTasks() business rule +- cli.js — added cleanup command + +## Business Rule Implemented +Tasks overdue by more than 7 days are automatically marked +as ABANDONED, unless they are HIGH or URGENT priority. + + program.parse(process.argv); // If no arguments, show help if (!process.argv.slice(2).length) { program.outputHelp(); -} \ No newline at end of file +} From 7656ae736c6493033fdeb7e4cd8b49014a12d2f4 Mon Sep 17 00:00:00 2001 From: smindlolennox-png Date: Tue, 17 Mar 2026 15:47:57 +0200 Subject: [PATCH 4/4] exercise-findings.md Signed-off-by: smindlolennox-png --- use-cases/exercise-findings.md | 76 ++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 use-cases/exercise-findings.md diff --git a/use-cases/exercise-findings.md b/use-cases/exercise-findings.md new file mode 100644 index 0000000..1354d11 --- /dev/null +++ b/use-cases/exercise-findings.md @@ -0,0 +1,76 @@ +# Task Manager Codebase Exercise Findings + +## Part 1: Project Structure +- *Entry point:* cli.js (confirmed by package.json "main": "cli.js") +- *Architecture:* 3-layer pattern + - CLI layer (cli.js) → calls Business logic (app.js) → calls Storage (storage.js) +- *Technologies:* Node.js, Commander.js, UUID, Jest +- *Key components:* + - cli.js — user commands + - app.js — TaskManager business logic + - models.js — Task, TaskPriority, TaskStatus entities + - storage.js — reads/writes tasks.json + - task_priority.js — scoring and sorting tasks + - task_parser.js — parses natural language into tasks + - task_list_merge.js — merges local and remote task lists + +## Part 2: CSV Export Feature Plan +- *New file needed:* task_export.js +- *Files to modify:* app.js (add exportTasks method), cli.js (add export command) +- *Reusable functions:* storage.getAllTasks() already exists + +## Part 3: Domain Model + +### Entity Diagram + +TaskPriority TaskStatus +LOW = 1 TODO +MEDIUM = 2 IN_PROGRESS +HIGH = 3 REVIEW +URGENT = 4 DONE + +Task +───────────────── +id (uuid) +title +description +priority → TaskPriority +status → TaskStatus +createdAt / updatedAt +dueDate / completedAt +tags[] + +Methods: +- update() +- markAsDone() +- isOverdue() + + +### Glossary +- *Task:* core unit of work +- *Priority:* urgency level (1-4) +- *Status:* lifecycle stage of a task +- *Tags:* labels for categorization +- *Overdue:* dueDate < today AND status != DONE +- *Score:* calculated weight used to sort tasks by importance + +### Quiz Answers +- Q: Can a DONE task be overdue? + A: No — isOverdue() returns false if status === DONE +- Q: What happens to completedAt when markAsDone() is called? + A: It gets set to new Date() (current timestamp) +- Q: Highest possible priority score? + A: URGENT(40) + overdue(30) + blocker tag(8) + recent update(5) = 83 + +## Part 4: Abandoned Tasks Rule + +### Files to Modify +1. models.js — add ABANDONED to TaskStatus +2. app.js — add markAbandonedTasks() method +3. cli.js — add cleanup command + +### Team Questions Before Implementing +1. Should ABANDONED tasks be hidden from the default list view? +2. Should we notify the user which tasks were abandoned? +3. Should HIGH priority tasks ever be auto-abandoned? +4. Should this run automatically on app start or manually?