This commit is contained in:
William 2022-04-20 09:02:19 +00:00
parent 149c43b889
commit d47a34d530
3 changed files with 11 additions and 13 deletions

View File

@ -76,8 +76,8 @@ class TimeMapper
{ {
$sth = $this->dbh->prepare('INSERT INTO tidtabell (LagID) VALUES (?)'); $sth = $this->dbh->prepare('INSERT INTO tidtabell (LagID) VALUES (?)');
$sth->execute([$time->team_id]); $sth->execute([$time->team_id]);
$lastId = $this->dbh->lastInsertId(); $last_id = $this->dbh->lastInsertId();
return $this->get($lastId); return $this->get($last_id);
} }
public function delete(int $id): void public function delete(int $id): void

View File

@ -1,3 +1,5 @@
<div id="alert" class="alert danger hidden" role="alert"></div>
<h1>Live resultater</h1> <h1>Live resultater</h1>
<br> <br>
@ -10,7 +12,8 @@ Laster inn...
</div> </div>
<script> <script>
var hash = 0; let hash = 0;
let alertbox = document.getElementById("alert");
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
loop(); loop();
@ -20,8 +23,10 @@ async function loop()
{ {
try { try {
await updateTable(); await updateTable();
alertbox.classList.add("hidden");
} catch (error) { } catch (error) {
console.log(error); alertbox.innerHTML = "<b>Noe gikk galt: </b>" + error;
alertbox.classList.remove("hidden");
} }
setTimeout(function() { setTimeout(function() {

View File

@ -24,7 +24,8 @@ foreach ($times as $time)
if (!$team) if (!$team)
{ {
return; // this should not happen as related times should be deleted with the team
#continue;
} }
$row = [ $row = [
@ -35,14 +36,6 @@ foreach ($times as $time)
array_push($data, $row); array_push($data, $row);
} }
$hash = crc32(serialize($data)); $hash = crc32(serialize($data));
if ($prev_hash !== $hash) if ($prev_hash !== $hash)