parent
5da73a0e3e
commit
f320d16c4b
|
@ -47,7 +47,7 @@ export default function SetList() {
|
||||||
if (!settings.predict) return setSet({...defaultSet});
|
if (!settings.predict) return setSet({...defaultSet});
|
||||||
const todaysPlan = await getTodaysPlan();
|
const todaysPlan = await getTodaysPlan();
|
||||||
console.log(`${SetList.name}.predict:`, {todaysPlan});
|
console.log(`${SetList.name}.predict:`, {todaysPlan});
|
||||||
if (todaysPlan.length === 0) return;
|
if (todaysPlan.length === 0) return setSet({...defaultSet});
|
||||||
const todaysSets = await getTodaysSets();
|
const todaysSets = await getTodaysSets();
|
||||||
const todaysWorkouts = todaysPlan[0].workouts.split(',');
|
const todaysWorkouts = todaysPlan[0].workouts.split(',');
|
||||||
let workout = todaysWorkouts[0];
|
let workout = todaysWorkouts[0];
|
||||||
|
@ -114,6 +114,7 @@ export default function SetList() {
|
||||||
}, [search, end, offset, sets]);
|
}, [search, end, offset, sets]);
|
||||||
|
|
||||||
const onAdd = useCallback(async () => {
|
const onAdd = useCallback(async () => {
|
||||||
|
console.log(`${SetList.name}.onAdd`, {set, defaultSet, workouts});
|
||||||
navigation.navigate('EditSet', {
|
navigation.navigate('EditSet', {
|
||||||
set: set || {...defaultSet},
|
set: set || {...defaultSet},
|
||||||
workouts,
|
workouts,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import {db, defaultSet} from './db';
|
import {db} from './db';
|
||||||
import {Periods} from './periods';
|
import {Periods} from './periods';
|
||||||
import Set from './set';
|
import Set from './set';
|
||||||
|
import {defaultSet} from './set.service';
|
||||||
import Volume from './volume';
|
import Volume from './volume';
|
||||||
|
|
||||||
export const getBestSet = async (name: string): Promise<Set> => {
|
export const getBestSet = async (name: string): Promise<Set> => {
|
||||||
|
|
8
db.ts
8
db.ts
|
@ -140,11 +140,3 @@ export interface PageParams {
|
||||||
limit: number;
|
limit: number;
|
||||||
offset: number;
|
offset: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const defaultSet = {
|
|
||||||
name: '',
|
|
||||||
id: 0,
|
|
||||||
reps: 10,
|
|
||||||
weight: 20,
|
|
||||||
unit: 'kg',
|
|
||||||
};
|
|
||||||
|
|
|
@ -84,9 +84,8 @@ export const getTodaysSets = async (): Promise<Set[]> => {
|
||||||
return result.rows.raw();
|
return result.rows.raw();
|
||||||
};
|
};
|
||||||
|
|
||||||
export const defaultSet = {
|
export const defaultSet: Set = {
|
||||||
name: '',
|
name: '',
|
||||||
id: 0,
|
|
||||||
reps: 10,
|
reps: 10,
|
||||||
weight: 20,
|
weight: 20,
|
||||||
unit: 'kg',
|
unit: 'kg',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user