Skip to content

fix: move streak validation to end-of-day check #3

Description

@abhay-gits

Refactor the current streak logic to validate streaks at the end of each day instead of updating immediately when habits are completed.

Goal:
Prevent accidental streak resets and ensure streak logic runs only once per day.

Problem:
Currently, streak updates are triggered during habit completion or modification. This can cause incorrect streak resets if the function runs multiple times (e.g., when deleting habits after completing them).

Solution:
Implement a daily streak validation system that:

  • Runs when the app is opened
  • Checks yesterday’s completion status
  • Updates streak only once per day
  • Prevents duplicate updates using lastStreakDate guard

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixsomething is not doing what it has to do

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions