Massive bug fix. Clear button added into fields.

This commit is contained in:
AG
2025-12-05 20:31:02 +02:00
parent 41d1d0f16a
commit 27afacee3f
14 changed files with 155 additions and 120 deletions

Binary file not shown.

View File

@@ -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 }
});

View File

@@ -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 {