Skip to content

fix: sort upcoming tasks by nearest due date#1180

Open
Ptmishra69 wants to merge 1 commit into
aryandas2911:mainfrom
Ptmishra69:fix/upcoming-tasks-sorting
Open

fix: sort upcoming tasks by nearest due date#1180
Ptmishra69 wants to merge 1 commit into
aryandas2911:mainfrom
Ptmishra69:fix/upcoming-tasks-sorting

Conversation

@Ptmishra69
Copy link
Copy Markdown

📌 Description

This PR fixes a bug in the Dashboard where the "Upcoming Tasks" panel displayed the most recently created tasks rather than the most urgent ones. The logic has been updated to filter tasks by dueDate presence and sort them chronologically, ensuring that tasks with the nearest deadlines appear first.

🔗 Related Issue

Closes #<insert_issue_number_here>

🛠 Changes Made

  • Updated upcomingTasks computation in Dashboard.jsx.
  • Added a condition to filter out tasks that do not have a dueDate.
  • Added a .sort() step to rank tasks in ascending order based on their due date.
  • Preserved the .slice(0, 2) logic to display only the top two most urgent tasks.

📸 Screenshots (if applicable)

N/A - This is a logic fix for how data is sorted, rather than a visual UI change.

✅ Checklist

  • Code runs locally
  • Followed project structure
  • No console errors
  • Properly tested changes
  • Linked the issue

🚀 Notes for Reviewers

The change is isolated to frontend/src/pages/Dashboard.jsx (lines 88-91). Tested locally with tasks having future, past, and no due dates to confirm the sorting behavior works as expected.

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