Simplify set prediction by returning early
This commit is contained in:
parent
cdb4ceec28
commit
64d046fe8f
10
SetList.tsx
10
SetList.tsx
|
@ -36,13 +36,13 @@ export default function SetList() {
|
|||
if (!settings.predict) return;
|
||||
const todaysPlan = await getTodaysPlan();
|
||||
if (todaysPlan.length === 0) return;
|
||||
const todaysSet = await getToday();
|
||||
const todaysWorkouts = todaysPlan[0].workouts.split(',');
|
||||
setWorkouts(todaysWorkouts);
|
||||
let workout = todaysWorkouts[0];
|
||||
let best = await getBestSet(workout);
|
||||
console.log({todaysSet, todaysWorkouts, todaysPlan});
|
||||
if (todaysSet && todaysWorkouts.includes(todaysSet.name)) {
|
||||
const todaysSet = await getToday();
|
||||
if (!todaysSet || !todaysWorkouts.includes(todaysSet.name))
|
||||
return setSet(best);
|
||||
let _count = await countToday(todaysSet.name);
|
||||
workout = todaysSet.name;
|
||||
best = await getBestSet(workout);
|
||||
|
@ -53,9 +53,7 @@ export default function SetList() {
|
|||
}
|
||||
if (best.name === '') setCount(0);
|
||||
else setCount(_count);
|
||||
}
|
||||
console.log({best});
|
||||
setSet({...best});
|
||||
setSet(best);
|
||||
}, []);
|
||||
|
||||
const refresh = useCallback(async () => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user