La til totalt antall påmeldte

This commit is contained in:
Trygve 2024-10-13 23:08:38 +02:00
parent b2afadedf1
commit 78c6f0e2dd
3 changed files with 30 additions and 13 deletions

View File

@ -80,6 +80,10 @@ function cmp(Runner $a, Runner $b) {
}
return 0;
}
function cmp_course(Runner $a, Runner $b) {
return strcmp($a->course, $b->course);
}
$runners = [];
$csv_runners = file_get_contents("db.csv");
@ -159,19 +163,39 @@ if ($query[0] == "registrering"){
}
}
elseif ($query[0] == "paameldte") {
echo(" <tr>
usort($runners, "cmp_course");
$kadaverløpere = 0;
$minikadaverløpere = 0;
for ($i = 0; $i < count($runners); $i++) {
if ($runners[$i]->course == "Kadaverløpet") {
$kadaverløpere++;
}
elseif ($runners[$i]->course == "Minikadaver'n") {
$minikadaverløpere++;
}
}
echo("<div class=\"flex space-evenly\">
<div class=\"flash accent\">$kadaverløpere påmeldte i Kadaverløpet</div><div class=\"flash accent\">$minikadaverløpere påmeldte i Minikadaver'n</div>
</div>");
echo("<table><tbody>
<tr>
<th>Navn</th>
<th>Klubb/Forening</th>
<th>Variant</th>
</tr>");
for ($i = 0; $i < count($runners); $i++) {
$runner = $runners[$i];
echo ("<td>$runner->name</td><td>$runner->club</td><td>$runner->course</td></tr>\n");
echo ("<tr><td>$runner->name</td><td>$runner->club</td><td>$runner->course</td></tr>\n");
}
echo("<table><tbody>");
}
else {
usort($runners, "cmp");
echo(" <tr>
echo("<table><tbody>
<tr>
<th>#</th>
<th>Startnummer</th>
<th>Navn</th>
@ -196,4 +220,5 @@ else {
}
echo ("<tr><td>". $i+1 .".</td><td>$runner->id</td><td>$runner->name</td><td>$tid_1_mat</td><td>$tid_2_mat</td><td>$tid_maal</td></tr>\n");
}
echo("</tbody></table>");
}

View File

@ -20,18 +20,13 @@
<h1>TESTING Løpende resultater kadaverløpet 2024</h1>
</div>
<h2>Vi tar forbehold om feil. Dette er ikke offisielle resultater</h2>
<table>
<tbody>
<?php
include("get_table.php")
?>
</tbody>
<footer>
</table>
<h3>Laget av Trygve. <a href="https://git.willy.club/Trygve/elektronisk-kadaver-tidtakingssystem">Kildekode</a></h3>
<figure><img src="img/NMBUI.webp" alt="" width="200px"></figure>
</footer>
</body>
<script>
function update() {
const table = document.querySelector("table");
@ -44,4 +39,5 @@ include("get_table.php")
}
setInterval(update, 5*1000)
</script>
</body>
</html>

View File

@ -19,16 +19,12 @@
<figure><img src="img/kadaver.png" alt="" width="100px" class="invert"></figure>
<h1>Påmeldte kadaverløpet 2024</h1>
</div>
<h2>Oppdatert 11.10.24</h2>
<table>
<tbody>
<h2>Oppdatert 13.10.24</h2>
<?php
$query = ["paameldte"];
include("get_table.php");
?>
</tbody>
<footer>
</table>
<h3>Laget av Trygve. <a href="https://git.willy.club/Trygve/elektronisk-kadaver-tidtakingssystem">Kildekode</a></h3>
<figure><img src="img/NMBUI.webp" alt="" width="200px"></figure>
</footer>