From 0e0053df1c505f608feba91a2aef1dc3ff237276 Mon Sep 17 00:00:00 2001 From: Dilshan Madusanka Date: Sun, 10 May 2026 19:35:19 +0530 Subject: [PATCH 01/11] Fix :Storage Key problem --- js/app.js | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/js/app.js b/js/app.js index 5dc8d87..9b5e596 100644 --- a/js/app.js +++ b/js/app.js @@ -1,5 +1,5 @@ const STORAGE_SAVE_KEY = "launchdesk-v1-items"; -const STORAGE_LOAD_KEY = "launchdesk-items-v1"; // Intentional bug: this key should match STORAGE_SAVE_KEY. +const STORAGE_LOAD_KEY = "launchdesk-v1-items"; const demoChecks = [ { @@ -91,7 +91,7 @@ const activityLog = document.getElementById("activityLog"); let checks = loadChecks(); let currentView = checks; -form.addEventListener("submit", (event) => handleAddChek(event)); // Intentional bug: misspelled function name. +form.addEventListener("submit", (event) => handleAddCheck(event)); searchInput.addEventListener("input", applyFilters); statusFilter.addEventListener("change", applyFilters); priorityFilter.addEventListener("change", applyFilters); @@ -132,8 +132,7 @@ function handleAddCheck(event) { const owner = ownerInput.value.trim() || "Unassigned"; const dueDate = dueDateInput.value || new Date().toISOString().slice(0, 10); - if (!title && !category) { - // Intentional bug: validation should stop when either required field is missing. + if (!title || !category) { formMessage.textContent = "Please enter a check title and choose a category."; return; @@ -164,12 +163,16 @@ function applyFilters() { const selectedPriority = priorityFilter.value; let filtered = checks.filter((check) => - check.owner.toLowerCase().includes(searchTerm), - ); // Intentional bug: search should include title, category, priority, status, and owner. + check.title.toLowerCase().includes(searchTerm) || + check.category.toLowerCase().includes(searchTerm) || + check.priority.toLowerCase().includes(searchTerm) || + check.status.toLowerCase().includes(searchTerm) || + check.owner.toLowerCase().includes(searchTerm) + ); if (selectedStatus !== "All") { - filtered = filtered.filter((check) => check.priority === selectedStatus); - } // Intentional bug: status filter compares against priority. + filtered = filtered.filter((check) => check.status === selectedStatus); + } if (selectedPriority !== "All") { filtered = filtered.filter((check) => check.priority === selectedPriority); @@ -191,7 +194,7 @@ function renderRows(list) { const rows = list.map((check) => { const priorityClass = `priority-${check.priority.toLowerCase()}`; - const statusClass = `status-${check.status.toLowerCase()}`; // Intentional bug: "In Progress" needs a slug class. + const statusClass = `status-${check.status.toLowerCase().replaceAll(" ", "-")}`; return ` @@ -231,11 +234,11 @@ function renderRows(list) { function updateMetrics() { const total = checks.length; - const fixed = checks.filter((check) => check.status === "Complete").length; // Intentional bug: valid fixed status is "Fixed". + const fixed = checks.filter((check) => check.status === "Fixed").length; const criticalOpen = checks.filter( (check) => check.priority === "Critical" && check.status !== "Fixed", ).length; - const dueSoon = checks.filter((check) => daysUntil(check.dueDate) > 7).length; // Intentional bug: this should count items due within 7 days. + const dueSoon = checks.filter((check) => daysUntil(check.dueDate) <= 7).length; const score = total === 0 ? 0 : Math.round((fixed / total) * 100); totalCount.textContent = total; @@ -247,13 +250,13 @@ function updateMetrics() { } function handleTableClick(event) { - const deleteButton = event.target.closest("[data-delete-id]"); // Intentional bug: button uses data-remove-id. + const deleteButton = event.target.closest("[data-remove-id]"); if (!deleteButton) { return; } - const id = Number(deleteButton.dataset.deleteId); + const id = Number(deleteButton.dataset.removeId); const removed = checks.find((check) => check.id === id); checks = checks.filter((check) => check.id !== id); saveChecks(); @@ -276,16 +279,16 @@ function handleStatusChange(event) { } check.status = statusSelect.value; - renderRows(currentView); + saveChecks(); + applyFilters(); logActivity(`Changed "${check.title}" to ${check.status}.`); - // Intentional bug: status changes should save, update filters, and refresh metrics. } async function resetDemoData() { formMessage.textContent = ""; try { - const response = await fetch("data/launch-seed.json"); // Intentional bug: real file is data/launch-checks.json. + const response = await fetch("data/launch-checks.json"); if (!response.ok) { throw new Error(`Demo data request failed with ${response.status}`); @@ -312,7 +315,7 @@ function exportCsv() { "Due Date", ]; const rows = currentView.map((check) => [ - check.name, // Intentional bug: property should be check.title. + check.title, check.category, check.priority, check.status, From ec07c60145106ebeb8918b04ae155cf3314d570b Mon Sep 17 00:00:00 2001 From: Dilshan Madusanka Date: Sun, 10 May 2026 19:44:11 +0530 Subject: [PATCH 02/11] Fix :Typo in Event Listener --- js/app.js | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/js/app.js b/js/app.js index 9b5e596..da3a21d 100644 --- a/js/app.js +++ b/js/app.js @@ -91,7 +91,7 @@ const activityLog = document.getElementById("activityLog"); let checks = loadChecks(); let currentView = checks; -form.addEventListener("submit", (event) => handleAddCheck(event)); +form.addEventListener("submit", (event) => handleAddCheck(event)); // Intentional bug: misspelled function name. searchInput.addEventListener("input", applyFilters); statusFilter.addEventListener("change", applyFilters); priorityFilter.addEventListener("change", applyFilters); @@ -132,7 +132,8 @@ function handleAddCheck(event) { const owner = ownerInput.value.trim() || "Unassigned"; const dueDate = dueDateInput.value || new Date().toISOString().slice(0, 10); - if (!title || !category) { + if (!title && !category) { + // Intentional bug: validation should stop when either required field is missing. formMessage.textContent = "Please enter a check title and choose a category."; return; @@ -163,16 +164,12 @@ function applyFilters() { const selectedPriority = priorityFilter.value; let filtered = checks.filter((check) => - check.title.toLowerCase().includes(searchTerm) || - check.category.toLowerCase().includes(searchTerm) || - check.priority.toLowerCase().includes(searchTerm) || - check.status.toLowerCase().includes(searchTerm) || - check.owner.toLowerCase().includes(searchTerm) - ); + check.owner.toLowerCase().includes(searchTerm), + ); // Intentional bug: search should include title, category, priority, status, and owner. if (selectedStatus !== "All") { - filtered = filtered.filter((check) => check.status === selectedStatus); - } + filtered = filtered.filter((check) => check.priority === selectedStatus); + } // Intentional bug: status filter compares against priority. if (selectedPriority !== "All") { filtered = filtered.filter((check) => check.priority === selectedPriority); @@ -194,7 +191,7 @@ function renderRows(list) { const rows = list.map((check) => { const priorityClass = `priority-${check.priority.toLowerCase()}`; - const statusClass = `status-${check.status.toLowerCase().replaceAll(" ", "-")}`; + const statusClass = `status-${check.status.toLowerCase()}`; // Intentional bug: "In Progress" needs a slug class. return ` @@ -234,11 +231,11 @@ function renderRows(list) { function updateMetrics() { const total = checks.length; - const fixed = checks.filter((check) => check.status === "Fixed").length; + const fixed = checks.filter((check) => check.status === "Complete").length; // Intentional bug: valid fixed status is "Fixed". const criticalOpen = checks.filter( (check) => check.priority === "Critical" && check.status !== "Fixed", ).length; - const dueSoon = checks.filter((check) => daysUntil(check.dueDate) <= 7).length; + const dueSoon = checks.filter((check) => daysUntil(check.dueDate) > 7).length; // Intentional bug: this should count items due within 7 days. const score = total === 0 ? 0 : Math.round((fixed / total) * 100); totalCount.textContent = total; @@ -250,13 +247,13 @@ function updateMetrics() { } function handleTableClick(event) { - const deleteButton = event.target.closest("[data-remove-id]"); + const deleteButton = event.target.closest("[data-delete-id]"); // Intentional bug: button uses data-remove-id. if (!deleteButton) { return; } - const id = Number(deleteButton.dataset.removeId); + const id = Number(deleteButton.dataset.deleteId); const removed = checks.find((check) => check.id === id); checks = checks.filter((check) => check.id !== id); saveChecks(); @@ -279,16 +276,16 @@ function handleStatusChange(event) { } check.status = statusSelect.value; - saveChecks(); - applyFilters(); + renderRows(currentView); logActivity(`Changed "${check.title}" to ${check.status}.`); + // Intentional bug: status changes should save, update filters, and refresh metrics. } async function resetDemoData() { formMessage.textContent = ""; try { - const response = await fetch("data/launch-checks.json"); + const response = await fetch("data/launch-seed.json"); // Intentional bug: real file is data/launch-checks.json. if (!response.ok) { throw new Error(`Demo data request failed with ${response.status}`); @@ -315,7 +312,7 @@ function exportCsv() { "Due Date", ]; const rows = currentView.map((check) => [ - check.title, + check.name, // Intentional bug: property should be check.title. check.category, check.priority, check.status, From 072b32a84027fd96bd4639d0b58b7ba5826856fc Mon Sep 17 00:00:00 2001 From: Dilshan Madusanka Date: Sun, 10 May 2026 19:51:22 +0530 Subject: [PATCH 03/11] Fix :Validation problem --- js/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/app.js b/js/app.js index da3a21d..b50dba2 100644 --- a/js/app.js +++ b/js/app.js @@ -132,7 +132,7 @@ function handleAddCheck(event) { const owner = ownerInput.value.trim() || "Unassigned"; const dueDate = dueDateInput.value || new Date().toISOString().slice(0, 10); - if (!title && !category) { + if (!title || !category) { // Intentional bug: validation should stop when either required field is missing. formMessage.textContent = "Please enter a check title and choose a category."; From b8598e29087b107896ac73a832bc1b41f0c8462c Mon Sep 17 00:00:00 2001 From: Dilshan Madusanka Date: Sun, 10 May 2026 20:04:22 +0530 Subject: [PATCH 04/11] Fix :Form Submit Event Bug --- js/app.js | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/js/app.js b/js/app.js index b50dba2..971dc9e 100644 --- a/js/app.js +++ b/js/app.js @@ -91,7 +91,7 @@ const activityLog = document.getElementById("activityLog"); let checks = loadChecks(); let currentView = checks; -form.addEventListener("submit", (event) => handleAddCheck(event)); // Intentional bug: misspelled function name. +form.addEventListener("submit", handleAddCheck); searchInput.addEventListener("input", applyFilters); statusFilter.addEventListener("change", applyFilters); priorityFilter.addEventListener("change", applyFilters); @@ -133,7 +133,6 @@ function handleAddCheck(event) { const dueDate = dueDateInput.value || new Date().toISOString().slice(0, 10); if (!title || !category) { - // Intentional bug: validation should stop when either required field is missing. formMessage.textContent = "Please enter a check title and choose a category."; return; @@ -164,12 +163,15 @@ function applyFilters() { const selectedPriority = priorityFilter.value; let filtered = checks.filter((check) => - check.owner.toLowerCase().includes(searchTerm), - ); // Intentional bug: search should include title, category, priority, status, and owner. + [check.title, check.category, check.priority, check.status, check.owner] + .join(" ") + .toLowerCase() + .includes(searchTerm), + ); if (selectedStatus !== "All") { - filtered = filtered.filter((check) => check.priority === selectedStatus); - } // Intentional bug: status filter compares against priority. + filtered = filtered.filter((check) => check.status === selectedStatus); + } if (selectedPriority !== "All") { filtered = filtered.filter((check) => check.priority === selectedPriority); @@ -191,7 +193,7 @@ function renderRows(list) { const rows = list.map((check) => { const priorityClass = `priority-${check.priority.toLowerCase()}`; - const statusClass = `status-${check.status.toLowerCase()}`; // Intentional bug: "In Progress" needs a slug class. + const statusClass = `status-${check.status.toLowerCase().replace(" ", "-")}`; return ` @@ -231,11 +233,14 @@ function renderRows(list) { function updateMetrics() { const total = checks.length; - const fixed = checks.filter((check) => check.status === "Complete").length; // Intentional bug: valid fixed status is "Fixed". + const fixed = checks.filter((check) => check.status === "Fixed").length; const criticalOpen = checks.filter( (check) => check.priority === "Critical" && check.status !== "Fixed", ).length; - const dueSoon = checks.filter((check) => daysUntil(check.dueDate) > 7).length; // Intentional bug: this should count items due within 7 days. + const dueSoon = checks.filter((check) => { + const days = daysUntil(check.dueDate); + return days >= 0 && days <= 7; + }).length; const score = total === 0 ? 0 : Math.round((fixed / total) * 100); totalCount.textContent = total; @@ -247,13 +252,13 @@ function updateMetrics() { } function handleTableClick(event) { - const deleteButton = event.target.closest("[data-delete-id]"); // Intentional bug: button uses data-remove-id. + const deleteButton = event.target.closest("[data-remove-id]"); if (!deleteButton) { return; } - const id = Number(deleteButton.dataset.deleteId); + const id = Number(deleteButton.dataset.removeId); const removed = checks.find((check) => check.id === id); checks = checks.filter((check) => check.id !== id); saveChecks(); @@ -276,16 +281,16 @@ function handleStatusChange(event) { } check.status = statusSelect.value; - renderRows(currentView); + saveChecks(); + applyFilters(); logActivity(`Changed "${check.title}" to ${check.status}.`); - // Intentional bug: status changes should save, update filters, and refresh metrics. } async function resetDemoData() { formMessage.textContent = ""; try { - const response = await fetch("data/launch-seed.json"); // Intentional bug: real file is data/launch-checks.json. + const response = await fetch("data/launch-checks.json"); if (!response.ok) { throw new Error(`Demo data request failed with ${response.status}`); @@ -312,7 +317,7 @@ function exportCsv() { "Due Date", ]; const rows = currentView.map((check) => [ - check.name, // Intentional bug: property should be check.title. + check.title, check.category, check.priority, check.status, From d06e98a8697d62b4bf31704662b8c6b4e556cc30 Mon Sep 17 00:00:00 2001 From: Dilshan Madusanka Date: Sun, 10 May 2026 20:07:55 +0530 Subject: [PATCH 05/11] Fix :Status Filter Bug From 17d8108abd9ab6eaa3be18571f79edd3ff5f5c42 Mon Sep 17 00:00:00 2001 From: Dilshan Madusanka Date: Sun, 10 May 2026 20:09:33 +0530 Subject: [PATCH 06/11] Fix :CSS Class Bug From 20078ccee8a7e9ec0e224d1c060400445980a22a Mon Sep 17 00:00:00 2001 From: Dilshan Madusanka Date: Sun, 10 May 2026 20:13:59 +0530 Subject: [PATCH 07/11] Fix :Due Soon Count Bug From d6800f1199ecf33709d41a53b379977dc04ce82b Mon Sep 17 00:00:00 2001 From: Dilshan Madusanka Date: Sun, 10 May 2026 20:16:32 +0530 Subject: [PATCH 08/11] Fix :Delete Button Bug From f130c9d83c283a8991bd78b093e00483dd7cda79 Mon Sep 17 00:00:00 2001 From: Dilshan Madusanka Date: Sun, 10 May 2026 20:17:41 +0530 Subject: [PATCH 09/11] Fix :Status Change Bug From ddbaeee45d7c1a15772656d509d4da67773df858 Mon Sep 17 00:00:00 2001 From: Dilshan Madusanka Date: Sun, 10 May 2026 20:18:33 +0530 Subject: [PATCH 10/11] Fix :Reset Demo Data Bug From d5c14d4701e4ed7ed12912eaffa383c0cbe2a117 Mon Sep 17 00:00:00 2001 From: Dilshan Madusanka Date: Sun, 10 May 2026 20:19:10 +0530 Subject: [PATCH 11/11] Fix :CSV Export Bug