8000 fix(habits): bad habit marked X today is not a habit still to do in Today by ahmet-cetinkaya · Pull Request #342 · ahmet-cetinkaya/whph · GitHub
[go: up one dir, main page]

Skip to content

fix(habits): bad habit marked X today is not a habit still to do in Today - #342

Merged
ahmet-cetinkaya merged 1 commit into
mainfrom
fix/today-bad-habit-x-not-todo
Nov 16, 2026
Merged

ahmet-cetinkaya merged 1 commit into
mainfrom
fix/today-bad-habit-x-not-todo

Conversation

@ahmet-cetinkaya
Copy link
Copy Markdown
Owner

What

A bad habit marked X (notDone) for today no longer appears as a habit still to complete — in the Today page filter and the home-screen widget.

Why

GetListHabitsQuery's completion filters (excludeCompletedForDate, excludeCompleted) kept bad habits with a notDone record today via an EXISTS ... status = notDone branch. That branch made an already-settled (failed) bad habit show up as "to do" in Today and, through the same query, in the widget. #341 patched only the widget side; the root was the query, so this moves the fix to the source and reverts the widget guard.

A bad habit still counts as failed for the day (streaks/statistics unchanged); undo stays available on the habit details page and by toggling from the habits list.

Changes

  • get_list_habits_query.dart: drop the EXISTS notDone branch from both filter variants; a bad habit is now hidden once it exists on an applicable date, X'd or not.
  • widget_data_aggregator.dart: revert the fix(widget): bad habit marked X today is not a habit still to complete #341 guard (dead code now that the query filters it out).
  • Tests updated to the new contract: habit_queries_integration_test.dart, habit_type_end_to_end_test.dart (was locking the old behavior), widget_data_aggregator_test.dart (guard tests removed with the guard).

Verification

  • flutter analyze clean on all touched files.
  • Green: habit_queries_integration_test.dart, habit_type_end_to_end_test.dart, widget_data_aggregator_test.dart, all test/core/application/features/habits + widget, test/presentation/ui/features/habits + calendar, habits_list_scroll_test.dart.
  • Not verified on a device (no phone attached); widget behavior is covered via the aggregator test and the shared query.

Follow-up idea (open note): render X'd bad habits in the widget with a distinct "failed" style instead of hiding them.

…n Today and widget

The excludeCompletedForDate and excludeCompleted filters kept a bad habit
with a notDone record today in the to-do list (the EXISTS notDone branch),
so both the Today page and the home widget asked for a habit already
settled for the day. Drop that branch from both filter variants and revert
the now-redundant widget-side guard from #341. Undo stays available on the
habit details page and via toggling from the habits list.
@ahmet-cetinkaya
ahmet-cetinkaya merged commit 8be45c3 into main Nov 16, 2026
4 checks passed
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

0