Repository navigation
fix(widget): bad habit marked X today is not a habit still to complete - #341
Merged
Merged
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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.dartlocks 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._getHabitsDataskips a bad habit whose resolved day state isfailed. Good habits and the query are unchanged, so the Today page and MCP keep their behaviour.Tests
Expected: empty, Actual: ['h1']), green with it.habit_type_end_to_end_testsuites: 103 passed.flutter analyzeon 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.