Răsfoiți Sursa

minderjährige aufführen

hmt 3 ani în urmă
părinte
comite
1a6b961737
2 a modificat fișierele cu 4 adăugiri și 4 ștergeri
  1. 3 3
      components/teams.svelte
  2. 1 1
      Übersicht.svelte

+ 3 - 3
components/teams.svelte

@@ -76,7 +76,7 @@
               <tr>
                 <td>{s.Name}</td>
                 <td>{s.Vorname}</td>
-                <td class="is-clickable" class:is-danger={!s.alter} class:is-warning={s.alter?.years > 0 && s.alter?.years < 18}>
+                <td class="is-clickable" class:is-danger={!s.age} class:is-warning={s.age > 0 && s.age < 18}>
                   <span
                     class="tag"
                     on:click={(_) => update_schueler(s)}
@@ -136,8 +136,8 @@
 <h3>Minderjährige</h3>
 <pre>
 {#each Object.entries(schueler) as [klasse, schueler]}
-{klasse}: {schueler.filter(s => s.alter?.years > 0 && s.alter?.years < 18).length}/{schueler.length} U18
-{#each schueler.filter(s => s.alter?.years > 0 && s.alter?.years < 18) as s}
+{klasse}: {schueler.filter(s => s.age > 0 && s.age < 18).length}/{schueler.length} U18
+{#each schueler.filter(s => s.age > 0 && s.age < 18) as s}
 {`b${s.id}@${privat.domain},${s.Name},${s.Vorname},${s.Vorname} ${s.Name},schueler,,,,,,,,Bielefeld,NW,,DE`}<br>
 {/each}
 {/each}

+ 1 - 1
Übersicht.svelte

@@ -97,7 +97,7 @@
   const mysql_connection = mysql.createConnection(knexConfig.connection)
   mysql_connection.connect()
   function hole_lokale_schueler () {
-    mysql_connection.query(`SELECT ID AS id, Name, Vorname, Klasse, Volljaehrig,
+    mysql_connection.query(`SELECT ID AS id, Name, Vorname, Klasse, Volljaehrig, TIMESTAMPDIFF(YEAR, Geburtsdatum, CURDATE()) AS age,
                               CONCAT (LOWER (Vorname), ' ', LOWER (Name)) AS vollname
                             FROM schueler
                             WHERE Status = 2 AND Geloescht = "-" AND Gesperrt = "-"