Skip to content

12 bugs fixed#3

Open
Shathulan_Kaneshapillai (shathulan) wants to merge 12 commits intocodezelaca:mainfrom
shathulan:main
Open

12 bugs fixed#3
Shathulan_Kaneshapillai (shathulan) wants to merge 12 commits intocodezelaca:mainfrom
shathulan:main

Conversation

@shathulan
Copy link
Copy Markdown

@shathulan Shathulan_Kaneshapillai (shathulan) commented May 9, 2026

Show a launch checklist with starter checks.

  • Add a new launch check with title, category, priority, status, owner, and due date.
  • Validate required fields.
  • Search by title, category, priority, status, and owner.
  • Filter by status and priority.
  • Update status from the checklist table.
  • Delete a check.
  • Calculate readiness score from checks marked Fixed.
  • Save updates in browser local storage.
  • Reload demo checks from data/launch-checks.json.
  • Export the current checklist view as CSV.
    all fixed

Summary by CodeRabbit

  • Bug Fixes
    • Fixed checklist persistence—saved items now load correctly
    • Fixed form submission for adding new checks
    • Improved search to match across all fields (title, category, priority, status, owner)
    • Corrected status filtering and metrics calculations
    • Fixed row deletion, CSV export, and demo data loading

Review Change Stack

…us === selectedStatus instead of incorrectly matching check.priority.
…ogress in app.js.

Co-authored-by: Copilot <copilot@github.com>
…app.js.

Co-authored-by: Copilot <copilot@github.com>
…pp.js

Co-authored-by: Copilot <copilot@github.com>
…-remove-id attribute in app.js.

Co-authored-by: Copilot <copilot@github.com>
…ers, and refreshes metrics in app.js.

Co-authored-by: Copilot <copilot@github.com>
…pp.js.

Co-authored-by: Copilot <copilot@github.com>
…ame in app.js.

Co-authored-by: Copilot <copilot@github.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 9, 2026

📝 Walkthrough

Walkthrough

This PR corrects ten functional bugs in a checklist application's core workflow: data persistence, form validation, search filtering, metrics calculation, deletion handling, status changes, demo data loading, and CSV export. All changes are in js/app.js.

Changes

Checklist Application Bug Corrections

Layer / File(s) Summary
Data Persistence
js/app.js
localStorage load key is updated to match the save key so persisted checks are correctly retrieved on page load.
Form Input & Validation
js/app.js
Form submit handler calls the correct handleAddCheck function; validation now rejects submission when title or category is missing.
Search & Display Filtering
js/app.js
Search filtering now matches across title, category, priority, status, and owner fields; status filter now correctly compares check.status instead of priority.
Metrics Calculation
js/app.js
"Fixed" count now uses "Fixed" status; "critical open" uses correct priority/status conditions; "due soon" now counts items due within 0–7 days.
Event Handlers & State Changes
js/app.js
Delete button event handling uses data-remove-id attribute; status changes now save checks, apply filters, and log activity to persist and refresh UI.
Data Access & Export
js/app.js
Demo reset now fetches correct data/launch-checks.json file path; CSV export writes check.title instead of nonexistent check.name.

🎯 4 (Complex) | ⏱️ ~45 minutes


🐰 Ten tiny bugs, once scattered and lost,
Now fixed with care, no data cost!
Persistence, filters, metrics so true,
The checklist app hops—good as new! ✓

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'twelve bugs fixed' accurately reflects the main objective of this changeset, which fixes multiple bugs in the application logic and functionality.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@js/app.js`:
- Around line 243-246: The due-soon count is wrong because daysUntil(dateValue)
currently uses new Date(dateValue) which parses "YYYY-MM-DD" as UTC; update
daysUntil to parse string inputs as local calendar dates by splitting
"YYYY-MM-DD" into year, month, day and constructing new Date(year, month-1, day)
(and handle Date inputs unchanged), then use the same local-date construction
logic in formatDate so both functions agree; update any callers (e.g., the
dueSoon calculation over checks and any formatting paths) to rely on the
corrected daysUntil and formatDate behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9ae8ff30-bf96-4f76-9387-5389e3121bdd

📥 Commits

Reviewing files that changed from the base of the PR and between ccb0d19 and f9d316a.

📒 Files selected for processing (1)
  • js/app.js

Comment thread js/app.js
Comment on lines +243 to +246
const dueSoon = checks.filter((check) => {
const days = daysUntil(check.dueDate);
return days >= 0 && days <= 7;
}).length;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
for tz in America/Los_Angeles America/New_York UTC; do
  echo "=== $tz ==="
  TZ=$tz node <<'NODE'
const dateValue = "2026-05-09";
const now = new Date("2026-05-09T23:00:00");
const target = new Date(dateValue);
const days = Math.ceil((target.getTime() - now.getTime()) / 86400000);
const display = new Intl.DateTimeFormat("en-US", {
  month: "short",
  day: "numeric",
  year: "numeric",
}).format(target);

console.log({
  now: now.toString(),
  target: target.toString(),
  display,
  days,
});
NODE
done

Repository: codezelaca/fs-se-debugging-bugs

Length of output: 690


🏁 Script executed:

# First, check if js/app.js exists and its size
wc -l js/app.js

Repository: codezelaca/fs-se-debugging-bugs

Length of output: 89


🏁 Script executed:

# Read lines around 243-246 to verify the code snippet
sed -n '240,250p' js/app.js

Repository: codezelaca/fs-se-debugging-bugs

Length of output: 473


🏁 Script executed:

# Find daysUntil function to verify implementation
rg -n "function daysUntil|daysUntil\s*\(" js/app.js -A 5

Repository: codezelaca/fs-se-debugging-bugs

Length of output: 521


🏁 Script executed:

# Find formatDate function to verify implementation
rg -n "function formatDate|formatDate\s*\(" js/app.js -A 8

Repository: codezelaca/fs-se-debugging-bugs

Length of output: 776


Parse dueDate as a local calendar date before computing "due soon".

The daysUntil() function parses YYYY-MM-DD strings with new Date(dateValue), which treats them as UTC. In US browsers this shifts the date to the previous local calendar day. A check due on May 9 renders as May 8 and can fall out of the 0..7 window late in the local day, making the due-soon count incorrect. Parse dates into local dates using new Date(year, month - 1, day) and align formatDate() to use the same helper.

Suggested fix
+function parseLocalDate(dateValue) {
+  if (!dateValue) {
+    return null;
+  }
+
+  const [year, month, day] = dateValue.split("-").map(Number);
+  return new Date(year, month - 1, day);
+}
+
 function daysUntil(dateValue) {
-  const today = new Date();
-  const target = new Date(dateValue);
-  const difference = target.getTime() - today.getTime();
-  return Math.ceil(difference / 86400000);
+  const target = parseLocalDate(dateValue);
+  if (!target) {
+    return Number.POSITIVE_INFINITY;
+  }
+
+  const today = new Date();
+  const startOfToday = new Date(
+    today.getFullYear(),
+    today.getMonth(),
+    today.getDate(),
+  );
+
+  return Math.round((target.getTime() - startOfToday.getTime()) / 86400000);
 }
 
 function formatDate(dateValue) {
   if (!dateValue) {
     return "No date";
   }
 
   return new Intl.DateTimeFormat("en", {
     month: "short",
     day: "numeric",
     year: "numeric",
-  }).format(new Date(dateValue));
+  }).format(parseLocalDate(dateValue));
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@js/app.js` around lines 243 - 246, The due-soon count is wrong because
daysUntil(dateValue) currently uses new Date(dateValue) which parses
"YYYY-MM-DD" as UTC; update daysUntil to parse string inputs as local calendar
dates by splitting "YYYY-MM-DD" into year, month, day and constructing new
Date(year, month-1, day) (and handle Date inputs unchanged), then use the same
local-date construction logic in formatDate so both functions agree; update any
callers (e.g., the dueSoon calculation over checks and any formatting paths) to
rely on the corrected daysUntil and formatDate behavior.

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.

1 participant