CodingAleCR / dayswithoutincidents

This is the android repository for the app published in Google Play: Days Without Incidents.
2 stars 1 forks source link

Rethink streak logic #23

Open CodingAleCR opened 6 months ago

CodingAleCR commented 6 months ago

An user commented that the way streaks are calculated could be wrong.

Currently: Streaks are calculated with start and end date of a counter restart.

Expected: Streaks are calculated with just the start date of each counter restart.

Rationale

Calculating streaks is complex when you have the end date of a counter restart in the middle of a different one. This means that the date selection should be restricted somehow to avoid duplicates. This is a fundamental challenge since it relies on checking and restricting dates.

On the other hand, if streaks and restarts where to be calculated with just a start date, then it'd be easier to calculate streaks and you wouldn't have to worry about duplicate restarts or conflicting periods.