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(
async (index: number) => {
setSelected(index);
console.log(`${StartPlan.name}.next:`, {name, workouts});
const workout = workouts[index];
console.log(`${StartPlan.name}.next:`, {name});
if (!counts) return;
const workout = counts[index];
console.log(`${StartPlan.name}.next:`, {workout});
const newBest = await getBestSet(workout);
const newBest = await getBestSet(workout.name);
setMinutes(newBest.minutes);
setSeconds(newBest.seconds);
setName(newBest.name);