Fehler beim speichern einer einzelnen Anwesenheit korrigiert. und Helfer jetzt editierbar
This commit is contained in:
parent
7f2454101e
commit
7dc599f11b
21
app.js
21
app.js
|
@ -903,6 +903,7 @@ app.post("/update-mitglied", requireAdmin, async (req, res) => {
|
|||
vorname,
|
||||
nachname,
|
||||
probe,
|
||||
helfer,
|
||||
} = req.body;
|
||||
try {
|
||||
if (type == "tel") {
|
||||
|
@ -919,8 +920,16 @@ app.post("/update-mitglied", requireAdmin, async (req, res) => {
|
|||
console.log("delete numer $1", [telid]);
|
||||
} else if (type == "adresse") {
|
||||
await pool.query(
|
||||
"UPDATE teilnehmende SET vorname = $1, nachname = $2, geburtsdatum = $3, adresse = $4, probe = $5 WHERE id = $6",
|
||||
[vorname, nachname, geburt, adresse, probe ? true : false, id]
|
||||
"UPDATE teilnehmende SET vorname = $1, nachname = $2, geburtsdatum = $3, adresse = $4, probe = $5, helfer = $6 WHERE id = $7",
|
||||
[
|
||||
vorname,
|
||||
nachname,
|
||||
geburt,
|
||||
adresse,
|
||||
probe ? true : false,
|
||||
helfer ? true : false,
|
||||
id,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1047,7 +1056,7 @@ app.post("/changelog", requireAdmin, async (req, res) => {
|
|||
});
|
||||
|
||||
app.post("/anwesend", requireAuth, async (req, res) => {
|
||||
const { anw, inriege, trainingId, riege } = req.body;
|
||||
var { anw, inriege, trainingId, riege } = req.body;
|
||||
req.session.activeTab = "anwesend";
|
||||
try {
|
||||
for (const mitgliedId of inriege) {
|
||||
|
@ -1055,8 +1064,6 @@ app.post("/anwesend", requireAuth, async (req, res) => {
|
|||
"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(
|
||||
|
@ -1066,7 +1073,11 @@ app.post("/anwesend", requireAuth, async (req, res) => {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!Array.isArray(anw)) {
|
||||
anw = [anw];
|
||||
}
|
||||
for (const teilnehmer of anw) {
|
||||
console.log(teilnehmer);
|
||||
const Tnresult = await pool.query(
|
||||
"SELECT *From anwesend WHERE fid_teilnehmer = $1 AND fid_training=$2",
|
||||
[teilnehmer, trainingId]
|
||||
|
|
|
@ -61,6 +61,9 @@
|
|||
<label for="probe"> Probetraining: </label>
|
||||
<input class="form-check-input" type="checkbox" name="probe" value="true" <%= mitglied.probe ? 'checked' : '' %>></br>
|
||||
|
||||
<label for="probe"> Helfer_in: </label>
|
||||
<input class="form-check-input" type="checkbox" name="helfer" value="true" <%= mitglied.helfer ? 'checked' : '' %>></br>
|
||||
|
||||
<button class="btn btn-success" type="submit">Speichern</button>
|
||||
</fieldset>
|
||||
|
||||
|
|
Loading…
Reference in New Issue