Anwesenheit bugfix

This commit is contained in:
Klaas 2024-06-06 22:17:19 +02:00
parent 8530cbf21b
commit 9a75483fa7
1 changed files with 2 additions and 2 deletions

4
app.js
View File

@ -822,14 +822,14 @@ app.post('/changelog', requireAdmin, async (req, res) => {
req.session.message = ['Error', error, 'error']; req.session.message = ['Error', error, 'error'];
res.render('changelog', { changes, session: req.session }); res.render('changelog', { changes, session: req.session });
} }
}) })
app.post('/anwesend', requireAuth, async (req, res) => { app.post('/anwesend', requireAuth, async (req, res) => {
const { anw, trainingId, riege } = req.body; const { anw, trainingId, riege } = req.body;
req.session.activeTab = 'anwesend'; req.session.activeTab = 'anwesend';
try { try {
await pool.query('Delete FROM anwesend WHERE fid_training = $1', [trainingId]); // await pool.query('Delete FROM anwesend WHERE fid_training = $1', [trainingId]);
for (const teilnehmer of anw) { for (const teilnehmer of anw) {
await pool.query('INSERT INTO anwesend (fid_teilnehmer, fid_training) VALUES ($1, $2)', [teilnehmer, trainingId]); await pool.query('INSERT INTO anwesend (fid_teilnehmer, fid_training) VALUES ($1, $2)', [teilnehmer, trainingId]);
} }