refactor: extract streak calculation to domain service
Move streak logic from application query to a dedicated domain service, making it reusable and properly tested for all habit configurations. - Support streaks for all habit types (boolean, counter, value) combined with positive/negative and optional target values - Handle weekly habits with specific days (streak counts scheduled days) - Today completed counts toward streak; not yet completed doesn't break it - Calculate current and longest streak in a single forward pass - Remove completion_rate from stats (not a useful metric for habits) - Add comprehensive unit tests covering all 10 type combinations
This commit is contained in:
@@ -384,8 +384,6 @@ definitions:
|
||||
type: object
|
||||
queries.HabitStatsDTO:
|
||||
properties:
|
||||
completion_rate:
|
||||
type: number
|
||||
completions_this_month:
|
||||
type: integer
|
||||
completions_this_week:
|
||||
|
||||
Reference in New Issue
Block a user