Skip to content

Conversation

@kalina559
Copy link
Collaborator

This solves #2070. I added a check to see if the last frequency period satisfies the measurable habit's goal.

  • DAILY - we're checking only today's entry
  • WEEKLY - the sum of entries from the last 7 days including today
  • MONTHLY - the sum of entries from the last 30 days including today

@iSoron
Copy link
Owner

iSoron commented Mar 24, 2025

Thanks for the PR, @kalina559, but unfortunately I think the solution needs to be more complex than this:

  1. Note that we don't use rolling windows for numerical habits. See the target chart, for example; we group repetitions by week, month, quarter and year. For this reason, the first day of the week also matters for numerical habits. I think we should hide a habit on the main screen if the first row in the target chart indicates 100% completion (for weekly habits, the first row is "Week"; for monthly habits, it is "Month"). The good news is that we already have the code to compute this row, so we could just use it here, instead of re-implementing it, like you did in this PR. See TargetCardPresenter.buildState.
  2. Skip days have an impact on the target. Specifically, if the goal is "reading 70 pages per week" and we skip one day, the target decreases to "63 pages" for that particular week. This is already handled in the existing code.
  3. I'm a bit concerned about running the code in TargetCardPresenter.buildState for every habit on the main screen; it may be too slow. We need to try it out with large lists of habits, and refactor for performance if needed.
  4. Ideally, we would not only hide the habit on the main screen, but also indicate through other means that the day is considered completed. I think this would include (i) marking the days as completed on the main screen, by making the number colorful, instead of black/grey; (ii) marking the day completed in the Calendar chart; (iii) marking the bars as completed in the History chart. This implies running the code above not just for every habit, but also for every day in its history, so we definitely could not use a naive implementation.

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.

2 participants