Anwesenheit bugfix
This commit is contained in:
parent
8530cbf21b
commit
9a75483fa7
4
app.js
4
app.js
|
@ -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]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue