Overview
Track Better uses a streak system to motivate consistent workout habits. Your current streak is prominently displayed in the app header and settings page, providing immediate feedback on your consistency.Streaks count consecutive days where you’ve logged at least one workout. Complete all exercises in a day’s workout to keep your streak alive.
How Streaks Work
The streak system counts backward from today, checking for completed workouts:Streak Calculation Logic
The core calculation is implemented inApp.jsx:46-65:
Why loop for 365 days?
Why loop for 365 days?
The loop has a maximum of 365 iterations to prevent infinite loops while allowing for year-long streaks. It will exit early (via
break) as soon as it finds a day without logged exercises, so it typically only runs a few iterations.Key Implementation Details
Midnight Reset
setHours(0, 0, 0, 0) ensures calculations start at the beginning of the day, avoiding time-of-day issues.Date Key Format
Uses YYYY-MM-DD format (e.g., “2026-03-07”) for consistent date lookups in localStorage.
Backward Iteration
Counts backward from today using
currentDate.setDate(currentDate.getDate() - 1).Early Exit
Breaks immediately upon finding a missing day, making the algorithm efficient.
Viewing Your Streak
Header Display
Your current streak appears in the app header: FromApp.jsx:214-219:
The streak counter only appears when
currentStreak > 0. If you haven’t logged any workouts, it won’t display.Settings Page Display
The Settings tab shows your streak in a dedicated card: FromSettingsTab.jsx:328-333:
What Counts Toward a Streak?
A day counts toward your streak if: ✅ At least one set is logged - Any exercise with logged sets counts ✅ Data exists in localStorage - The date key exists incompletedExercises
✅ No gap in consecutive days - Every day between your streak must have logs
Storage Structure
The streak calculation checks for keys in this structure:Maintaining Your Streak
Don't reset by accident
Be careful with the “Reset Today’s Progress” button, as it can break your streak.
Streak Reset Scenarios
Your streak will reset to 0 in these situations: ❌ Missed a day - No exercises logged for any date ❌ Hard reset - Using “Hard Reset All Data” in Settings ❌ Cleared localStorage - Manually clearing browser data ❌ Reset today before midnight - Deleting today’s logs ends your streakLongest Streak
Currently, the app only tracks your current streak. It does not calculate or store:- Longest streak ever
- Total workout days (non-consecutive)
- Average streak length
completedExercises data:
Statistics in Settings
The Settings tab calculates and displays comprehensive statistics:Summary Calculation
FromSettingsTab.jsx:107-129:
Displayed Metrics
Current Streak
Consecutive days with logged workouts.
Total Days Logged
Total number of dates with workout data (non-consecutive).
Sets Completed
All-time count of logged sets across all workouts.
Exporting Streak Data
When you export your data from Settings, it includes:summary object includes your current streak at the time of export.
Importing data from another device will restore your streak if the data includes consecutive days up to today.
Timezone Considerations
The app uses local device time for all calculations:What happens if I travel across timezones?
What happens if I travel across timezones?
Since the app uses
new Date() without timezone conversion, it will use your device’s local time. If you log a workout at 11 PM in New York, then fly to London (5 hours ahead) and open the app at 3 AM local time (10 PM New York time), the app will consider it the same day in New York but the next day in London.This could potentially break your streak if you don’t log anything on the “London day.” For most users, this isn’t an issue since they stay in the same timezone.Motivation and Gamification
Streaks are a powerful motivational tool:Visual Feedback
The fire emoji 🔥 creates positive association with consistency.
Loss Aversion
Users don’t want to “lose” their streak, encouraging daily logging.
Progress Tracking
Seeing the number increase provides tangible progress feedback.
Social Proof
When sharing the app, users can show off their streak numbers.