Fix selection for plan starting

Old selection index was based on `workouts`
new one is based on the `counts`.
This commit is contained in:
Brandon Presley 2022-10-27 10:07:02 +13:00
parent 4e6de66f90
commit 4735b1589b
1 changed files with 4 additions and 3 deletions

View File

@ -88,10 +88,11 @@ export default function StartPlan() {
const select = useCallback( const select = useCallback(
async (index: number) => { async (index: number) => {
setSelected(index); setSelected(index);
console.log(`${StartPlan.name}.next:`, {name, workouts}); console.log(`${StartPlan.name}.next:`, {name});
const workout = workouts[index]; if (!counts) return;
const workout = counts[index];
console.log(`${StartPlan.name}.next:`, {workout}); console.log(`${StartPlan.name}.next:`, {workout});
const newBest = await getBestSet(workout); const newBest = await getBestSet(workout.name);
setMinutes(newBest.minutes); setMinutes(newBest.minutes);
setSeconds(newBest.seconds); setSeconds(newBest.seconds);
setName(newBest.name); setName(newBest.name);