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

Skip to content

fix(widget): bad habit marked X today is not a habit still to complete - #341

Merged
ahmet-cetinkaya merged 1 commit into
mainfrom
fix/bad-habit-x-not-todo-in-widget
Nov 15, 2026
Merged

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

Conversation

@ahmet-cetinkaya
Copy link
Copy Markdown
Owner

Problem (ACF-96)

A bad habit with an X (not done) mark for today was listed by the home-screen habits widget with an empty checkbox, like a habit still to complete.

Cause

GetListHabitsQuery(excludeCompletedForDate) is an include filter. For a bad habit with no record today (resolved as successful) it leaves the habit out, but with an X record (resolved as failed) it keeps it in. The Today page needs that (it shows the X and lets the user undo it; habit_type_end_to_end_test.dart locks it in). The widget aggregator took the query result as is, and the native widget (HabitsRemoteViewsFactory) draws every listed habit that is not completed as an empty checkbox.

Fix

WidgetDataAggregator._getHabitsData skips a bad habit whose resolved day state is failed. Good habits and the query are unchanged, so the Today page and MCP keep their behaviour.

Tests

  • New: bad habit with an X today is not listed; a good habit with an X today and a good habit with no mark are still listed. Verified red without the fix (Expected: empty, Actual: ['h1']), green with it.
  • Habit, widget and habit_type_end_to_end_test suites: 103 passed. flutter analyze on the touched folders: no issues.

Not verified

I did not run the widget on a device or take a screenshot (none available here). The check is at the data level, in the payload the native widget reads.

Open product question

After the X the widget no longer shows the bad habit, so it cannot be undone from the widget; undo stays on the Today page. Say if the widget should show it in a done or failed style instead.

@ahmet-cetinkaya
ahmet-cetinkaya marked this pull request as ready for review November 15, 2026 11:19
@ahmet-cetinkaya
ahmet-cetinkaya merged commit 37867cc into main Nov 15, 2026
4 checks passed
@ahmet-cetinkaya
ahmet-cetinkaya deleted the fix/bad-habit-x-not-todo-in-widget branch November 16, 2026 18:46
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