-
Notifications
You must be signed in to change notification settings - Fork 179
Fix/hide waiting tasks #607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Apprentice2907
wants to merge
15
commits into
CCExtractor:main
Choose a base branch
from
Apprentice2907:fix/hide-waiting-tasks
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
4e11c2d
Improve date picker flow handling
Apprentice2907 9f7813b
Preserve taskd.trust when importing and exporting taskrc
Apprentice2907 eb65d40
Added A status Filter For Deleted Tasks
Apprentice2907 067d869
fix: auto-dismiss TaskServer not configured banner
Apprentice2907 4a8a400
Merge branch 'main' into TaskServer-is-not-configured
Apprentice2907 8c60251
Solved CI
Apprentice2907 7bd6b29
Merge remote changes and fix filters.dart
Apprentice2907 984cb12
Fix analyzer errors by separating TagFilters model and updating imports
Apprentice2907 b91ed32
Fix Flutter analyzer errors and update Filters tests
Apprentice2907 2984c68
fix: hide blocked tasks filter and depends UI (#595)
Apprentice2907 698c4f4
Fixes:Android Widget crashes
Apprentice2907 4e92d2c
Follow System Locale with Optional Override
Apprentice2907 1b649ea
Fixes: Hide waiting tasks
Apprentice2907 e79b4b8
fix: hide waiting tasks by default
Apprentice2907 54f2a24
Merge branch 'main' into fix/hide-waiting-tasks
Apprentice2907 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,38 @@ | ||
| import 'package:taskwarrior/app/services/tag_filter.dart'; | ||
| // lib/app/models/filters.dart | ||
|
|
||
| import 'package:taskwarrior/app/models/tag_filters.dart'; | ||
|
|
||
|
|
||
| class Filters { | ||
| const Filters({ | ||
| required this.pendingFilter, | ||
| required this.waitingFilter, | ||
| required this.completedFilter, | ||
| required this.deletedFilter, | ||
| required this.togglePendingFilter, | ||
| required this.toggleWaitingFilter, | ||
| required this.toggleCompletedFilter, | ||
| required this.toggleDeletedFilter, | ||
| required this.tagFilters, | ||
| required this.projects, | ||
| required this.projectFilter, | ||
| required this.toggleProjectFilter, | ||
| required this.hideBlocked, // ADD | ||
| required this.toggleHideBlocked, | ||
| }); | ||
|
|
||
| final bool pendingFilter; | ||
| final bool waitingFilter; | ||
| final bool completedFilter; | ||
| final bool deletedFilter; | ||
| final void Function() togglePendingFilter; | ||
| final void Function() toggleWaitingFilter; | ||
| final void Function() toggleCompletedFilter; | ||
| final void Function() toggleDeletedFilter; | ||
| final TagFilters tagFilters; | ||
| final dynamic projects; | ||
| final String projectFilter; | ||
| final void Function(String) toggleProjectFilter; | ||
| final bool hideBlocked; | ||
| final void Function() toggleHideBlocked; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // lib/app/models/tag_filters.dart | ||
|
|
||
| class TagFilterMetadata { | ||
| const TagFilterMetadata({ | ||
| required this.display, | ||
| required this.selected, | ||
| }); | ||
|
|
||
| final String display; | ||
| final bool selected; | ||
| } | ||
|
|
||
| class TagFilters { | ||
| const TagFilters({ | ||
| required this.tagUnion, | ||
| required this.toggleTagUnion, | ||
| required this.tags, | ||
| required this.toggleTagFilter, | ||
| }); | ||
|
|
||
| final bool tagUnion; | ||
| final void Function() toggleTagUnion; | ||
| final Map<String, TagFilterMetadata> tags; | ||
| final void Function(String) toggleTagFilter; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filter logic structure is confusing and potentially incorrect.
The
waitingFiltercheck (lines 292-298) sits outside the main if-else chain and runs afterhideBlockedfiltering. This means whenwaitingFilteris enabled, it completely replacesqueriedTaskswith a fresh query, ignoring thehideBlockedfilter that was just applied.If this is intentional (waiting tasks should ignore blocked filtering), the code flow would be clearer with
waitingFilterinside the main if-else chain. If unintentional, blocked tasks would incorrectly appear when viewing waiting tasks.Additionally:
DateTime.now()is called twice (lines 277 and 293); consider capturing it once at the method start.Suggested refactor to clarify intent
void _refreshTasks() { - + var currentTime = DateTime.now(); + if (deletedFilter.value) { queriedTasks.value = storage.data .completedData() .where((task) => task.status == 'deleted') .toList(); } else if (completedFilter.value) { queriedTasks.value = storage.data .completedData() .where((task) => task.status == 'completed') .toList(); + } else if (waitingFilter.value) { + queriedTasks.value = storage.data.pendingData().where((task) => + task.status == 'waiting' || + (task.wait != null && task.wait!.isAfter(currentTime)) + ).toList(); } else if (pendingFilter.value) { queriedTasks.value = storage.data .pendingData() .where((task) => task.status == 'pending') .toList(); } else { - var currentTime = DateTime.now(); queriedTasks.value = storage.data.pendingData().where((task) => task.status != 'waiting' && !(task.wait != null && task.wait!.isAfter(currentTime)) ).toList(); } if (hideBlocked.value) { queriedTasks.value = queriedTasks .where((task) => task.depends == null || task.depends!.isEmpty) .toList(); } - - // Rest of the method stays the same... - if (waitingFilter.value) { - var currentTime = DateTime.now(); - queriedTasks.value = storage.data.pendingData().where((task) => - task.status == 'waiting' || - (task.wait != null && task.wait!.isAfter(currentTime)) - ).toList(); - }🤖 Prompt for AI Agents