Commit Graph
3 Commits
Author SHA1 Message Date
rootandClaude Sonnet 5 a9923f72ce Add streaks and milestone badges
No gamification existed at all - nothing rewarded consistency or gave
users a reason to come back beyond the raw session stats already on
the dashboard. Adds a Gamification helper that derives (not stores)
a current/longest daily streak from completed WorkoutSessions and six
badges (first session, 10 and 50 sessions, 7- and 30-day streaks, a
100kg+ completed lift) from existing session/session-item data - no new
tables, since everything needed is already recorded.

Found and fixed a real Carbon 3 behavior change via testing: diffInDays()
no longer returns an absolute value by default (unlike Carbon 2) - it
returns a signed float. My longest-streak calculation used a strict
=== 1 check against the raw result, which silently always failed
because float(-1) or float(1) never strictly equals int 1. Fixed with
abs() plus an explicit (int) cast. Worth remembering for any other
diffIn*() usage in this codebase going forward.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-10 12:44:24 +03:00
rootandClaude Sonnet 5 1cc21ad0c5 Add body weight logging with a trend on the dashboard
No way existed to log body weight over time - only the single
self-reported value from the signup profile - and the dashboard showed
session activity but nothing about physical progress, which is usually
the main reason people keep using a fitness app.

Adds a WeightLog model (one entry per user per day, re-logging the same
day updates it rather than duplicating), a quick-add form and trend
summary on the dashboard, and delete support.

Found and fixed a real bug along the way: the first implementation used
WeightLog::updateOrCreate() with a raw ['logged_at' => $date] match
array, which silently failed to find the same-day entry because the
`date` cast stores full datetime strings ('2026-01-01 00:00:00') while
the match array holds a plain 'Y-m-d' string - so re-logging the same
day hit a unique-constraint violation instead of updating. Fixed by
using a whereDate() lookup instead, which is comparison-format-safe.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-10 12:10:08 +03:00
root d1bc362fab added yoga stuff, i18n, workout tracking and a dashboard to track progress 2025-10-04 17:55:30 +03:00