Refactoring data model

This commit is contained in:
Will Baumbach
2026-03-26 16:49:50 -05:00
parent 7ae3dbd27f
commit 349ac48fa2
4 changed files with 860 additions and 928 deletions

View File

@@ -11,16 +11,16 @@
<th>Sunday</th>
<th>Total Milage</th>
</tr>
@for (week of examplePlan.workouts; track $index) {
@for (planWeek of examplePlan.planDetials; track $index) {
<tr>
<td>
<div>Week {{$index + 1}}</div>
<div>Week {{planWeek.week}}</div>
</td>
@for (day of week; track $index) {
@for (workout of planWeek.workouts; track $index) {
<td class="hoverOverWorkout">
<div>{{day.type}}</div>
<div>{{day.totalDistance == 0 ? '' : day.totalDistance + ' miles'}}</div>
<div>{{day.description}}</div>
<div>{{workout.type}}</div>
<div>{{workout.totalDistance == 0 ? '' : workout.totalDistance + ' miles'}}</div>
<div>{{workout.description}}</div>
</td>
}
<td>43</td>

View File

@@ -6,5 +6,10 @@ export interface Plan {
startDate: Date,
endDate: Date,
numWeeks: number,
workouts: Workout[][]
planDetials: Week[]
}
export interface Week {
week: number,
workouts: Workout[]
}

View File

@@ -1,5 +1,4 @@
export interface Workout {
week: number
day: number,
type: WorkoutType,
totalDistance: number,

View File

@@ -7,924 +7,852 @@ export const examplePlan: Plan = {
startDate: new Date('2026-03-23'),
endDate: new Date('2026-03-23'),
numWeeks: 18,
workouts: [
[
planDetials: [
{
week: 1,
workouts: [
{
day: 0,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 1,
day: 1,
type: WorkoutType.Threshold,
totalDistance: 8,
description: '20-25 min LT'
},
{
week: 1,
day: 2,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 1,
day: 3,
type: WorkoutType.GeneralAerobic,
totalDistance: 8,
description: ''
},
{
week: 1,
day: 4,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 1,
day: 5,
type: WorkoutType.Recovery,
totalDistance: 4,
description: ''
},
{
week: 1,
day: 6,
type: WorkoutType.LongRun,
totalDistance: 11,
description: ''
}
],
[
]
},
{
week: 2,
workouts: [
{
day: 0,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 2,
day: 1,
type: WorkoutType.GeneralAerobic,
totalDistance: 8,
description: '6 x 10s Hills, 8 x 100m strides'
},
{
week: 2,
day: 2,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 2,
day: 3,
type: WorkoutType.GeneralAerobic,
totalDistance: 9,
description: ''
},
{
week: 2,
day: 4,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 2,
day: 5,
type: WorkoutType.Recovery,
totalDistance: 4,
description: ''
},
{
week: 2,
day: 6,
type: WorkoutType.MarathonPaceLongRun,
totalDistance: 12,
description: '8 mi @ marathon pace'
}
],
[
]
},
{
week: 3,
workouts: [
{
day: 0,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 3,
day: 1,
type: WorkoutType.GeneralAerobic,
totalDistance: 9,
description: ''
},
{
week: 3,
day: 2,
type: WorkoutType.Recovery,
totalDistance: 4,
description: ''
},
{
week: 3,
day: 3,
type: WorkoutType.Threshold,
totalDistance: 8,
description: '25-30 min LT'
},
{
week: 3,
day: 4,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 3,
day: 5,
type: WorkoutType.Recovery,
totalDistance: 4,
description: ''
},
{
week: 3,
day: 6,
type: WorkoutType.LongRun,
totalDistance: 14,
description: ''
}
],
[
]
},
{
week: 4,
workouts: [
{
day: 0,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 4,
day: 1,
type: WorkoutType.GeneralAerobic,
totalDistance: 8,
description: '6 x 10s Hills, 8 x 100m strides'
},
{
week: 4,
day: 2,
type: WorkoutType.Recovery,
totalDistance: 4,
description: ''
},
{
week: 4,
day: 3,
type: WorkoutType.GeneralAerobic,
totalDistance: 9,
description: ''
},
{
week: 4,
day: 4,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 4,
day: 5,
type: WorkoutType.Recovery,
totalDistance: 4,
description: ''
},
{
week: 4,
day: 6,
type: WorkoutType.LongRun,
totalDistance: 15,
description: ''
}
],
[
]
},
{
week: 5,
workouts: [
{
day: 0,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 5,
day: 1,
type: WorkoutType.Threshold,
totalDistance: 9,
description: '30-35 min LT'
},
{
week: 5,
day: 2,
type: WorkoutType.Recovery,
totalDistance: 5,
description: ''
},
{
week: 5,
day: 3,
type: WorkoutType.GeneralAerobic,
totalDistance: 9,
description: ''
},
{
week: 5,
day: 4,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 5,
day: 5,
type: WorkoutType.Recovery,
totalDistance: 4,
description: ''
},
{
week: 5,
day: 6,
type: WorkoutType.MarathonPaceLongRun,
totalDistance: 15,
description: '10 mi @ marathon pace'
}
],
[
]
},
{
week: 6,
workouts: [
{
day: 0,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 6,
day: 1,
type: WorkoutType.GeneralAerobic,
totalDistance: 7,
description: '10 x 100m strides'
},
{
week: 6,
day: 2,
type: WorkoutType.Recovery,
totalDistance: 4,
description: ''
},
{
week: 6,
day: 3,
type: WorkoutType.GeneralAerobic,
totalDistance: 7,
description: ''
},
{
week: 6,
day: 4,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 6,
day: 5,
type: WorkoutType.Recovery,
totalDistance: 4,
description: ''
},
{
week: 6,
day: 6,
type: WorkoutType.LongRun,
totalDistance: 11,
description: ''
}
],
[
]
},
{
week: 7,
workouts: [
{
day: 0,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 7,
day: 1,
type: WorkoutType.Threshold,
totalDistance: 9,
description: '30-35 min LT'
},
{
week: 7,
day: 2,
type: WorkoutType.Recovery,
totalDistance: 4,
description: ''
},
{
week: 7,
day: 3,
type: WorkoutType.MediumLongRun,
totalDistance: 11,
description: ''
},
{
week: 7,
day: 4,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 7,
day: 5,
type: WorkoutType.GeneralAerobic,
totalDistance: 7,
description: '6 x 10s Hills, 8 x 100m strides'
},
{
week: 7,
day: 6,
type: WorkoutType.LongRun,
totalDistance: 17,
description: ''
}
],
[
]
},
{
week: 8,
workouts: [
{
day: 0,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 8,
day: 1,
type: WorkoutType.Recovery,
totalDistance: 6,
description: '6x100 strides'
},
{
week: 8,
day: 2,
type: WorkoutType.MediumLongRun,
totalDistance: 12,
description: ''
},
{
week: 8,
day: 3,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 8,
day: 4,
type: WorkoutType.Threshold,
totalDistance: 10,
description: '35-40 min LT'
},
{
week: 8,
day: 5,
type: WorkoutType.Recovery,
totalDistance: 4,
description: ''
},
{
week: 8,
day: 6,
type: WorkoutType.LongRun,
totalDistance: 19,
description: ''
}
],
[
]
},
{
week: 9,
workouts: [
{
day: 0,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 9,
day: 1,
type: WorkoutType.Recovery,
totalDistance: 6,
description: ''
},
{
week: 9,
day: 2,
type: WorkoutType.MediumLongRun,
totalDistance: 13,
description: ''
},
{
week: 9,
day: 3,
type: WorkoutType.Recovery,
totalDistance: 6,
description: ''
},
{
week: 9,
day: 4,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 9,
day: 5,
type: WorkoutType.Recovery,
totalDistance: 5,
description: '6x100 strides'
},
{
week: 9,
day: 6,
type: WorkoutType.MarathonPaceLongRun,
totalDistance: 16,
description: '12 mi @ marathon pace'
}
],
[
]
},
{
week: 10,
workouts: [
{
day: 0,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 10,
day: 1,
type: WorkoutType.GeneralAerobic,
totalDistance: 8,
description: ''
},
{
week: 10,
day: 2,
type: WorkoutType.VO2Max,
totalDistance: 8,
description: '6 x 600m @ 5K pace'
},
{
week: 10,
day: 3,
type: WorkoutType.Recovery,
totalDistance: 4,
description: ''
},
{
week: 10,
day: 4,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 10,
day: 5,
type: WorkoutType.GeneralAerobic,
totalDistance: 7,
description: '6 x 10s Hills, 8 x 100m strides'
},
{
week: 10,
day: 6,
type: WorkoutType.LongRun,
totalDistance: 13,
description: ''
}
],
[
]
},
{
week: 11,
workouts: [
{
day: 0,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 11,
day: 1,
type: WorkoutType.Recovery,
totalDistance: 6,
description: '6x100 strides'
},
{
week: 11,
day: 2,
type: WorkoutType.Threshold,
totalDistance: 11,
description: '35-45 min LT'
},
{
week: 11,
day: 3,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 11,
day: 4,
type: WorkoutType.MediumLongRun,
totalDistance: 12,
description: ''
},
{
week: 11,
day: 5,
type: WorkoutType.Recovery,
totalDistance: 4,
description: ''
},
{
week: 11,
day: 6,
type: WorkoutType.LongRun,
totalDistance: 19,
description: ''
}
],
[
]
},
{
week: 12,
workouts: [
{
day: 0,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 12,
day: 1,
type: WorkoutType.GeneralAerobic,
totalDistance: 10,
description: ''
},
{
week: 12,
day: 2,
type: WorkoutType.VO2Max,
totalDistance: 8,
description: '5 x 600m @ 5K pace'
},
{
week: 12,
day: 3,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 12,
day: 4,
type: WorkoutType.Recovery,
totalDistance: 4,
description: '6x100 strides'
},
{
week: 12,
day: 5,
type: WorkoutType.VO2Max,
totalDistance: 10,
description: '8K-15K Tune Up'
},
{
week: 12,
day: 6,
type: WorkoutType.LongRun,
totalDistance: 16,
description: ''
}
],
[
]
},
{
week: 13,
workouts: [
{
day: 0,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 13,
day: 1,
type: WorkoutType.Recovery,
totalDistance: 6,
description: ''
},
{
week: 13,
day: 2,
type: WorkoutType.VO2Max,
totalDistance: 9,
description: '5 x 1000m @ 5K pace'
},
{
week: 13,
day: 3,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 13,
day: 4,
type: WorkoutType.MediumLongRun,
totalDistance: 11,
description: ''
},
{
week: 13,
day: 5,
type: WorkoutType.Recovery,
totalDistance: 5,
description: ''
},
{
week: 13,
day: 6,
type: WorkoutType.MarathonPaceLongRun,
totalDistance: 17,
description: '14 mi @ marathon pace'
}
],
[
]
},
{
week: 14,
workouts: [
{
day: 0,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 14,
day: 1,
type: WorkoutType.GeneralAerobic,
totalDistance: 10,
description: ''
},
{
week: 14,
day: 2,
type: WorkoutType.VO2Max,
totalDistance: 8,
description: '5 x 600m @ 5K pace'
},
{
week: 14,
day: 3,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 14,
day: 4,
type: WorkoutType.Recovery,
totalDistance: 4,
description: '6x100 strides'
},
{
week: 14,
day: 5,
type: WorkoutType.VO2Max,
totalDistance: 10,
description: '8K-15K Tune Up'
},
{
week: 14,
day: 6,
type: WorkoutType.LongRun,
totalDistance: 16,
description: ''
}
],
[
]
},
{
week: 15,
workouts: [
{
day: 0,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 15,
day: 1,
type: WorkoutType.Recovery,
totalDistance: 6,
description: ''
},
{
week: 15,
day: 2,
type: WorkoutType.VO2Max,
totalDistance: 9,
description: '5 x 1000m @ 5K pace'
},
{
week: 15,
day: 3,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 15,
day: 4,
type: WorkoutType.MediumLongRun,
totalDistance: 11,
description: ''
},
{
week: 15,
day: 5,
type: WorkoutType.Recovery,
totalDistance: 4,
description: ''
},
{
week: 15,
day: 6,
type: WorkoutType.LongRun,
totalDistance: 19,
description: ''
}
],
[
]
},
{
week: 16,
workouts: [
{
day: 0,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 16,
day: 1,
type: WorkoutType.GeneralAerobic,
totalDistance: 7,
description: '6 x 10s Hills, 10 x 100m strides'
},
{
week: 16,
day: 2,
type: WorkoutType.Recovery,
totalDistance: 5,
description: ''
},
{
week: 16,
day: 3,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 16,
day: 4,
type: WorkoutType.Recovery,
totalDistance: 4,
description: '4-5 mi w/ 6x100 strides'
},
{
week: 16,
day: 5,
type: WorkoutType.VO2Max,
totalDistance: 9,
description: '8K-10K Tune Up'
},
{
week: 16,
day: 6,
type: WorkoutType.LongRun,
totalDistance: 16,
description: ''
}
],
[
]
},
{
week: 17,
workouts: [
{
day: 0,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 17,
day: 1,
type: WorkoutType.Recovery,
totalDistance: 6,
description: '8x100 strides'
},
{
week: 17,
day: 2,
type: WorkoutType.VO2Max,
totalDistance: 8,
description: '5 x 1000m @ 5K pace'
},
{
week: 17,
day: 3,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 17,
day: 4,
type: WorkoutType.Recovery,
totalDistance: 5,
description: '6x100 strides'
},
{
week: 17,
day: 5,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 17,
day: 6,
type: WorkoutType.LongRun,
totalDistance: 12,
description: ''
}
],
[
]
},
{
week: 18,
workouts: [
{
day: 0,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 18,
day: 1,
type: WorkoutType.Recovery,
totalDistance: 5,
description: '8x100 strides'
},
{
week: 18,
day: 2,
type: WorkoutType.DressRehersal,
totalDistance: 5,
description: '2 mi @ marathon pace'
},
{
week: 18,
day: 3,
type: WorkoutType.Rest,
totalDistance: 0,
description: ''
},
{
week: 18,
day: 4,
type: WorkoutType.Recovery,
totalDistance: 4,
description: '6x100 strides'
},
{
week: 18,
day: 5,
type: WorkoutType.Recovery,
totalDistance: 2,
description: ''
},
{
week: 18,
day: 6,
type: WorkoutType.RaceDay,
totalDistance: 26.2,
description: ''
}
],
]
}
]
};