Liste der Anwesenheiten auf Mitgliederseite
This commit is contained in:
parent
adf955cbc7
commit
cd59aa0546
11
app.js
11
app.js
|
@ -101,19 +101,13 @@ const isBirthday = (birthdate, date, previousTraining) => {
|
|||
let adjustedBirthdate = new Date(birthdate);
|
||||
adjustedBirthdate.setFullYear(date.getFullYear());
|
||||
|
||||
if (adjustedBirthdate.getMonth() == 10) {
|
||||
console.log("checking:", adjustedBirthdate, date, previousTraining);
|
||||
}
|
||||
|
||||
if (adjustedBirthdate.getTime() === date.getTime()) {
|
||||
console.log("birthday");
|
||||
return 2;
|
||||
}
|
||||
if (
|
||||
adjustedBirthdate.getTime() >= previousTraining.getTime() &&
|
||||
adjustedBirthdate.getTime() <= date.getTime()
|
||||
) {
|
||||
console.log("had birthday");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -926,9 +920,11 @@ app.get("/mitglied/:id", requireAuth, requireAdmin, async (req, res) => {
|
|||
}
|
||||
req.session.activeRiege = riege;
|
||||
const anwesendResult = await pool.query(
|
||||
"SELECT * FROM anwesend WHERE fid_teilnehmer = $1",
|
||||
"SELECT t.id, TO_CHAR(t.datum, 'DD.MM.YYYY') as date, t.* FROM trainings t JOIN anwesend a ON t.id = a.fid_training WHERE a.fid_teilnehmer = $1;",
|
||||
[id]
|
||||
);
|
||||
console.log(anwesendResult);
|
||||
const anwesenheiten = anwesendResult.rows;
|
||||
const anwesend = anwesendResult.rows.length;
|
||||
const numberResult = await pool.query(
|
||||
"SELECT telefonnummern.*, telverbindung.bezeichnung FROM telefonnummern JOIN telverbindung ON telefonnummern.verbindung = telverbindung.id WHERE telefonnummern.fid_teilnehmer = $1",
|
||||
|
@ -945,6 +941,7 @@ app.get("/mitglied/:id", requireAuth, requireAdmin, async (req, res) => {
|
|||
mitglied: mitglied[0],
|
||||
numbers,
|
||||
riege,
|
||||
anwesenheiten,
|
||||
anwesend,
|
||||
session: req.session,
|
||||
});
|
||||
|
|
|
@ -153,6 +153,13 @@
|
|||
</div>
|
||||
<% } %>
|
||||
|
||||
<ul>
|
||||
|
||||
<% anwesenheiten.forEach(date => { %>
|
||||
<li> <%= date.date %> </li>
|
||||
<% }) %>
|
||||
</ul>
|
||||
|
||||
<script>
|
||||
function toggleDivs() {
|
||||
$('#view').toggleClass('d-none d-block');
|
||||
|
|
Loading…
Reference in New Issue