diff --git a/src/lib/trpc/routes/users.ts b/src/lib/trpc/routes/users.ts index e5bdfccd..b20572e7 100644 --- a/src/lib/trpc/routes/users.ts +++ b/src/lib/trpc/routes/users.ts @@ -218,7 +218,8 @@ export const users = t.router({ startOverloadPercentage: 0, userId: ctx.userId, exerciseSplitId: templateIdx ? mesocycleTemplateIds[templateIdx] : null, - RIRProgression: mesocycleTemplates[templateIdx].RIRProgression.map(({ cycles }) => cycles) + RIRProgression: + templateIdx === -1 ? [1] : mesocycleTemplates[templateIdx].RIRProgression.map(({ cycles }) => cycles) }; if (firstWorkout) { diff --git a/src/routes/mesocycles/[mesocycleId]/(components)/MesocycleSplitTab.svelte b/src/routes/mesocycles/[mesocycleId]/(components)/MesocycleSplitTab.svelte index 810a58c9..dc58ba9a 100644 --- a/src/routes/mesocycles/[mesocycleId]/(components)/MesocycleSplitTab.svelte +++ b/src/routes/mesocycles/[mesocycleId]/(components)/MesocycleSplitTab.svelte @@ -17,29 +17,33 @@ } - - The current split of the mesocycle - - - { - selectedSplitDay = mesocycle.mesocycleExerciseSplitDays.find((splitDay) => splitDay.name === v)!; - }} - value={selectedSplitDay.name} -> - - {#each mesocycle.mesocycleExerciseSplitDays as splitDay} - - {splitDay.isRestDay ? 'Rest' : splitDay.name} - - {/each} - - - {#each selectedSplitDay.mesocycleSplitDayExercises as exercise} - - {/each} - - +{#if mesocycle.mesocycleExerciseSplitDays.length > 0} + + The current split of the mesocycle + + + { + selectedSplitDay = mesocycle.mesocycleExerciseSplitDays.find((splitDay) => splitDay.name === v)!; + }} + value={selectedSplitDay.name} + > + + {#each mesocycle.mesocycleExerciseSplitDays as splitDay} + + {splitDay.isRestDay ? 'Rest' : splitDay.name} + + {/each} + + + {#each selectedSplitDay.mesocycleSplitDayExercises as exercise} + + {/each} + + +{:else} +
Mesocycle template for this mesocycle in V2 seems to have been deleted
+{/if}