Workout Templates & Athlete Logging System
Overview
The BPVA Calendar App now includes a comprehensive workout template and logging system specifically designed for pole vault training. This system allows coaches/admins to create detailed workout templates, and athletes to log their actual performance against those templates.
How Workouts Work
Two-Part System:
- Workout Templates (Created by Coaches)
- Reusable workout plans you create as an admin/coach
- Include all prescribed exercises, sets, reps, and pole vault parameters
- Can be assigned to all athletes or specific groups
- Athletes use these as a guide for their training
- Workout Logs (Completed by Athletes)
- Individual athlete’s record of what they actually did
- Based on your template but tracks their actual performance
- Includes athlete notes, difficulty ratings, and your feedback
- Helps you monitor athlete progress and compliance
Workout Template Structure
Template Information:
- Name: Descriptive workout title (e.g., “Takeoff Mechanics Day”)
- Goal: What this workout aims to improve (optional)
- Difficulty: Beginner, Intermediate, or Advanced
- Duration: Estimated time in minutes
- Equipment Needed: List of required equipment
- Visibility: Who can see this template (all athletes, specific athletes, coaches only)
Workout Segments:
Each workout is divided into segments by type:
- Warmup: Links to warmup drill sequences
- Technique: Pole vault technical drills
- Strength: Weight room exercises
- Vaulting: Full approach vaults
- Conditioning: Cardio and endurance work
- Cooldown: Stretching and recovery
Exercise Details:
For each exercise in a segment, you can specify:
Standard Parameters:
- Sets and reps
- Duration (e.g., “10 minutes”, “30 seconds”)
- Rest time between sets
- Intensity (e.g., “70% max”, “moderate”, “RPE 7”)
- Tempo (e.g., “slow eccentric”, “explosive”)
- Weight or load
Pole Vault Specific:
- Grip height (e.g., “12’0"”, “3.65m”)
- Pole specification (e.g., “14’ 155”, “4.27m 75kg”)
- Approach steps (e.g., 3, 6, 8, 12 step approach)
- Bar height (e.g., “10’6"”, “no bar”, “3.20m”)
Additional Info:
- Exercise instructions and description
- Video demonstration links
- Reference images
- Scaling options for different skill levels
- Substitute exercises
Athlete Workout Logs
What Athletes Track:
When athletes complete your workout template, they log:
Actual Performance:
- Actual sets, reps, duration completed
- Actual weights used
- Actual pole, grip height, approach steps, bar height
- Completion status for each exercise
Subjective Feedback:
- RPE (Rate of Perceived Exertion) 1-10 scale for each exercise
- Overall workout difficulty rating
- Personal notes about how it felt
- Video uploads of their vaulting (optional)
Completion Tracking:
- Start and end time
- Which exercises were completed vs skipped
- Overall completion percentage (auto-calculated)
Coach Feedback:
As an admin/coach, you can:
- Review athlete’s logged workout
- See what they actually did vs what was prescribed
- Add feedback and coaching notes
- Monitor progress over time
- Adjust future workouts based on performance
workout_logs
- Created by: Athletes (when starting a workout)
- Read access:
- Athlete who owns the log
- All coaches/admins
- Write access:
- Athlete who owns the log (full access)
- Coaches/admins (can add feedback)
- Document ID: Auto-generated by Firestore
Legacy workouts Collection
The old workouts collection is still present but deprecated. It will eventually be migrated to the new template system.
Service Layer
WorkoutTemplateService
Located at: lib/services/workout_template_service.dart
Template Management (Coach/Admin):
createTemplate(template)- Create new templategetAllTemplates()- Get all templatesgetTemplatesByCoach(userId)- Get templates by specific coachgetVisibleTemplates({userId})- Get templates visible to athletesgetTemplateById(templateId)- Get specific templateupdateTemplate(templateId, template)- Update templatedeleteTemplate(templateId)- Delete template
Workout Log Management (Athlete):
createWorkoutLog(log)- Create new logstartWorkoutFromTemplate({userId, templateId, scheduledDate})- Start workout from templategetWorkoutLogsByUser(userId)- Get all logs for usergetWorkoutLogsByDateRange({userId, startDate, endDate})- Get logs in date rangegetWorkoutLogById(logId)- Get specific logupdateWorkoutLog(logId, log)- Update log (auto-calculates completion %)completeWorkout(logId)- Mark workout as completedaddCoachFeedback({logId, feedback, coachUserId})- Add coach feedbackdeleteWorkoutLog(logId)- Delete log
Analytics:
getUserWorkoutStats(userId)- Get completion statsstreamWorkoutLogsByUser(userId)- Real-time log updatesstreamTemplates()- Real-time template updates
UI Screens
Admin/Coach Screens
AdminWorkoutTemplateScreen
Location: lib/screens/admin/admin_workout_template_screen.dart
- Lists all workout templates
- Expandable cards showing template details
- Create, edit, delete templates
- Navigate to full editor screen
WorkoutTemplateEditorScreen
Location: lib/screens/admin/workout_template_editor.dart
- Full-screen editor for creating/editing templates
- Organized into cards:
- Basic Information (name, goal, difficulty, duration, visibility)
- Equipment list
- Workout segments (add, edit, reorder, delete)
- Save/update functionality
Athlete Screens
AthleteWorkoutScreen
Location: lib/screens/athlete/athlete_workout_screen.dart
Two tabs:
- Available Tab:
- Shows all visible workout templates
- “Start” button to begin a workout
- My Logs Tab:
- Shows athlete’s workout history
- Progress indicators (completion percentage)
- “Continue” button for incomplete workouts
- View completed workouts
WorkoutLoggingScreen
Location: lib/screens/athlete/athlete_workout_screen.dart
- Progress bar showing overall completion
- Segment navigation (tabs for warmup, technique, strength, etc.)
- Exercise cards with:
- Checkbox to mark completed
- Fields to enter actual sets, reps, weight
- Notes field
- Expandable to show all fields
- Auto-save progress
- “Complete Workout” button
Integration with Existing Features
Warmup Drills Integration
Workout segments can reference existing warmup drill groups:
WorkoutSegment(
type: SegmentType.warmup,
warmupDrillGroupId: "A0O081Yx66c2onp8geAO", // References warmup_drills collection
)
This allows coaches to reuse the comprehensive warmup drill library already built.
User Role Integration
The workout system respects existing role hierarchy:
- Admins: Full access to templates and logs
- BPVA Coaches: Can create templates, view all athlete logs
- External Coaches: Can create templates, view logs (if granted)
- Athletes: Can view assigned templates, create and manage their own logs
- Parents: Can view their linked athlete’s workout logs (via existing parent-athlete linking)
Workflow Examples
Coach Creating a Template
- Navigate to Admin Dashboard → Workout Templates
- Click “New Template”
- Fill in basic info (name, goal, difficulty, duration, visibility)
- Add equipment needed
- Add segments (e.g., Warmup, Technique, Vaulting, Cooldown)
- For each segment, add exercises with prescribed parameters
- Save template
Athlete Logging a Workout
- Open “My Workouts” screen
- Navigate to “Available” tab
- Find desired workout and tap “Start”
- Work through each segment:
- View prescribed exercise details
- Enter actual sets, reps, weight performed
- Mark exercises as completed
- Add notes about performance
- Progress bar updates automatically
- When done, tap “Complete Workout”
Coach Reviewing Athlete Performance
- Navigate to admin area (future feature)
- View athlete workout logs
- See completion percentage and actual vs. prescribed values
- Add coach feedback/evaluation
Future Enhancements
Phase 2 Features
- Exercise library (reusable exercise definitions)
- Full segment editor with exercise selection
- Workout assignment system (assign specific templates to specific athletes)
- Workout calendar integration (schedule workouts on specific dates)
- Analytics dashboard (athlete progress tracking over time)
- Coach feedback interface
- Video upload for exercise form review
- Social features (share PRs, workout completion)
Phase 3 Features
- Workout programs (multi-week training plans)
- Periodization tools
- Auto-progression (automatically adjust weights/intensities)
- Meet prep workflows
- Recovery and injury tracking integration
- Nutrition logging
- Export workout data to PDF
Database Indexes
Recommended Firestore indexes (add to firestore.indexes.json):
{
"indexes": [
{
"collectionGroup": "workout_templates",
"queryScope": "COLLECTION",
"fields": [
{ "fieldPath": "visibility", "order": "ASCENDING" },
{ "fieldPath": "createdAt", "order": "DESCENDING" }
]
},
{
"collectionGroup": "workout_logs",
"queryScope": "COLLECTION",
"fields": [
{ "fieldPath": "userId", "order": "ASCENDING" },
{ "fieldPath": "scheduledDate", "order": "DESCENDING" }
]
},
{
"collectionGroup": "workout_logs",
"queryScope": "COLLECTION",
"fields": [
{ "fieldPath": "userId", "order": "ASCENDING" },
{ "fieldPath": "completed", "order": "ASCENDING" },
{ "fieldPath": "scheduledDate", "order": "DESCENDING" }
]
}
]
}
Testing
Unit Tests
- Model serialization/deserialization
- Service CRUD operations
- Completion percentage calculation
- Template-to-log conversion
Integration Tests
- Coach creates template → athlete starts workout
- Athlete logs progress → coach views and adds feedback
- Template visibility rules
- Parent viewing athlete logs
Widget Tests
- Template editor form validation
- Exercise log card interaction
- Progress calculation display
- Segment navigation
Notes for Development
- Pole Vault Context: All exercise templates support pole vault-specific fields (grip height, pole used, approach steps, bar height)
- Offline Support: Consider implementing offline persistence for workout logging (athletes may not have internet in gym)
- Media Uploads: Video URLs are stored as strings - integrate with Firebase Storage for actual video uploads
- Performance: Use pagination for workout log lists if athletes accumulate many logs
- Validation: Add validation for pole vault measurements (e.g., grip height should be less than pole length)
Migration from Legacy System
The old workouts collection used a simpler structure. To migrate:
- Create a migration script to convert old workouts to templates
- Preserve old data by copying to
workout_templateswith appropriate metadata - Add deprecation notice in old workout management screen
- Eventually remove old collection after full migration
For questions or support, contact the development team or refer to the main app documentation in .github/copilot-instructions.md.