rebuild anwesenheit

This commit is contained in:
Klaas 2024-06-17 19:20:03 +02:00
parent 17d6c92563
commit ded94b266c
2 changed files with 3 additions and 1 deletions

2
app.js
View File

@ -830,6 +830,8 @@ app.post('/anwesend', requireAuth, async (req, res) => {
try {
for (const mitgliedId of inriege){
const Idresult = await pool.query('SELECT *From anwesend WHERE fid_teilnehmer = $1 AND fid_training=$2', [mitgliedId, trainingId])
console.log(anw);
console.log(inriege);
if (Idresult.rows.length > 0) {
if (!anw.includes(mitgliedId)){
await pool.query('Delete FROM anwesend WHERE fid_teilnehmer = $1 AND fid_training=$2', [mitgliedId, trainingId])

View File

@ -143,7 +143,7 @@
<%= teilnehmer.vorname %> <%= teilnehmer.nachname %>
</td>
<td>
<input type="checkbox" name="anw" <%= teilnehmer.anwesend ? 'checked' : '' %> value="<%= teilnehmer.id %>">
<input type="hidden" name="inriege" value="<%= teilnehmer.id %>" /> <input type="checkbox" name="anw" <%= teilnehmer.anwesend ? 'checked' : '' %> value="<%= teilnehmer.id %>">
<% }}) %>
</td>
</tr>