Massive bug fix. Clear button added into fields.
This commit is contained in:
@@ -25,7 +25,13 @@ router.get('/', async (req: any, res) => {
|
||||
try {
|
||||
const userId = req.user.userId;
|
||||
const sessions = await prisma.workoutSession.findMany({
|
||||
where: { userId },
|
||||
where: {
|
||||
userId,
|
||||
OR: [
|
||||
{ endTime: { not: null } },
|
||||
{ type: 'QUICK_LOG' }
|
||||
]
|
||||
},
|
||||
include: { sets: { include: { exercise: true } } },
|
||||
orderBy: { startTime: 'desc' }
|
||||
});
|
||||
@@ -505,7 +511,6 @@ router.patch('/active/set/:setId', async (req: any, res) => {
|
||||
height: height !== undefined ? (height ? parseFloat(height) : null) : undefined,
|
||||
bodyWeightPercentage: bodyWeightPercentage !== undefined ? (bodyWeightPercentage ? parseFloat(bodyWeightPercentage) : null) : undefined,
|
||||
side: side !== undefined ? side : undefined,
|
||||
note: note !== undefined ? note : undefined,
|
||||
},
|
||||
include: { exercise: true }
|
||||
});
|
||||
|
||||
@@ -7,10 +7,15 @@ const prisma = new PrismaClient();
|
||||
async function backup() {
|
||||
try {
|
||||
console.log('Starting backup...');
|
||||
const sporadicSets = await prisma.sporadicSet.findMany();
|
||||
// Backup Quick Log sessions and their sets (formerly SporadicSets)
|
||||
const quickLogSessions = await prisma.workoutSession.findMany({
|
||||
where: { type: 'QUICK_LOG' },
|
||||
include: { sets: true }
|
||||
});
|
||||
|
||||
const backupPath = path.join(__dirname, '../../sporadic_backup.json');
|
||||
fs.writeFileSync(backupPath, JSON.stringify(sporadicSets, null, 2));
|
||||
console.log(`Backed up ${sporadicSets.length} sporadic sets to ${backupPath}`);
|
||||
fs.writeFileSync(backupPath, JSON.stringify(quickLogSessions, null, 2));
|
||||
console.log(`Backed up ${quickLogSessions.length} quick log sessions to ${backupPath}`);
|
||||
} catch (error) {
|
||||
console.error('Backup failed:', error);
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user