nødfikser

This commit is contained in:
Trygve 2024-11-05 12:57:13 +01:00
parent 2284704031
commit 27a924584e

View File

@ -1,6 +1,6 @@
<?php <?php
date_default_timezone_set('UTC'); date_default_timezone_set('UTC');
$GLOBALS['start_time'] = DateTime::createFromFormat(DateTime::ISO8601, "2024-11-01T10:07:32+01"); $GLOBALS['start_time'] = DateTime::createFromFormat(DateTime::ISO8601, "2024-11-02T08:53:00+01");
$GLOBALS['number_of_controls'] = 3; $GLOBALS['number_of_controls'] = 3;
//declare(strict_types=1); //declare(strict_types=1);
@ -35,9 +35,8 @@ class Runner
} }
function get_control() function get_control()
{ { for ($i = 0; $i < count($this->splits); $i++) {
// Returns wich control the runner last passed
for ($i = 0; $i < count($this->splits); $i++) {
if (!is_object($this->splits[$i])) { if (!is_object($this->splits[$i])) {
return $i-1; return $i-1;
} }
@ -230,10 +229,12 @@ else {
<th>Mål</th> <th>Mål</th>
</tr></thead> </tr></thead>
<tbody>"; <tbody>";
$kadaver_num = 0;
$mini_num = 0;
for ($i = 0; $i < count($runners); $i++) { for ($i = 0; $i < count($runners); $i++) {
$runner = $runners[$i]; $runner = $runners[$i];
if ($runner->course == "Kadaverløpet") { if ($runner->course == "Kadaverløpet") {
$kadaver_num++;
$tid_1_mat = ""; $tid_1_mat = "";
if ($runner->splits[0] != false) { if ($runner->splits[0] != false) {
// https://www.php.net/manual/en/class.dateinterval.php // https://www.php.net/manual/en/class.dateinterval.php
@ -245,20 +246,21 @@ else {
} }
$matposter = "<td>$tid_1_mat</td><td>$tid_2_mat</td>"; $matposter = "<td>$tid_1_mat</td><td>$tid_2_mat</td>";
} }
else {
$mini_num++;
}
$tid_maal = ""; $tid_maal = "";
if ($runner->splits[2] != false) { if ($runner->splits[2] != false) {
$tid_maal = $GLOBALS['start_time']->diff($runner->splits[2])->format('%H:%I:%S'); $tid_maal = $GLOBALS['start_time']->diff($runner->splits[2])->format('%H:%I:%S');
} }
if ($runner->course == "Kadaverløpet") { if ($runner->course == "Kadaverløpet") {
$kadaver_table .= "<tr><td>". $i+1 .".</td><td>$runner->name</td>$matposter<td>$tid_maal</td></tr>\n"; $kadaver_table .= "<tr><td>". $kadaver_num .".</td><td>$runner->name</td>$matposter<td>$tid_maal</td></tr>\n";
} }
elseif ($runner->course == "Minikadaver'n") { elseif ($runner->course == "Minikadaver'n") {
$minikadaver_table .= "<tr><td>". $i+1 .".</td><td>$runner->name</td><td>$tid_maal</td></tr>\n"; $minikadaver_table .= "<tr><td>". "" .".</td><td>$runner->name</td><td>$tid_maal</td></tr>\n";
} }
} }
$kadaver_table .= "</tbody></table>"; $kadaver_table .= "</tbody></table>";
$minikadaver_table .= "</tbody></table>"; $minikadaver_table .= "</tbody></table>";
echo($kadaver_table); echo($kadaver_table);
echo("<h2>Minikadaver'n</h2>");
echo($minikadaver_table);
} }