Repository navigation
feat: use due date as secondary key for priority sorting - #665
Neo-matrix-coder wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Shared priority comparator and validation lib/app/utils/taskfunctions/comparator.dart, test/utils/taskfunctions/comparator_test.dart |
The shared comparator ranks H, M, and L as 3, 2, and 1. Other and null priorities rank 0. Equal ranks sort by due date, with dated tasks before undated tasks. Tests cover both sort directions, ties, and null priorities. |
Home task sorting behavior lib/app/modules/home/controllers/home_controller.dart, lib/app/modules/home/views/show_tasks.dart, lib/app/modules/home/views/show_tasks_replica.dart |
The controller passes the full selected sort value to compareTasks for priority sorting. Both task views use priority ranks and due-date tie-breaks. Due-date sorting handles absent or invalid dates. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Feature
Suggested reviewers: nishantsinghal19, brawlerxull, its-me-abhishek
Merge Risk: 
Minimal · up to 783ff
-
No issue introduced by this change remains established after the review. The preexisting null-priority rendering failure can be addressed separately.
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (5 skipped: 5 unsupported.)
Full details: Description check
-
Explanation
The pull request description is mostly complete. It includes a detailed summary, the fixed issue number, implementation details, tests, and checklist status. It does not explicitly state whether dependencies are required, and it omits the Screenshots section, but these omissions are non-critical for this change.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
|
@MabudAlam PTAL!! |
Description
When sorting tasks by priority, tasks sharing the same priority level were previously ordered arbitrarily (or solely based on how they were fetched/inserted).
This PR enhances priority-based sorting across the app by introducing due date as a secondary sorting key:
H,M,L, or none) are now broken down by due date in ascending order (earlier due dates appear first)._priorityRankseverity mapping (H>M>L> unassigned) across the task views and comparator functions.TaskViewBuilderandTaskReplicaViewBuilderas well asHomeControllerto maintain consistent sorting behavior everywhere tasks are displayed.Changes Summary:
lib/app/utils/taskfunctions/comparator.dart:_priorityRankand_compareDuehelpers.Priority,Priority+, andPriority-comparators to break priority ties using_compareDue.lib/app/modules/home/views/show_tasks.dart&show_tasks_replica.dart:_priorityRankand_compareDueinto the view sorting switches.lib/app/modules/home/controllers/home_controller.dart:Prioritycolumn delegates properly tocompareTasks.test/utils/taskfunctions/comparator_test.dart:Priority+) and descending (Priority-) sort consistency.Fixes #527
Checklist
Summary by CodeRabbit