Commit
This commit is contained in:
parent
1b83f16213
commit
6544901bdd
@ -1,6 +1,6 @@
|
||||
<div id="alertBox" class="alert danger hidden" role="alert"></div>
|
||||
|
||||
<h1>Resultatservice</h1>
|
||||
<h1>Resultater</h1>
|
||||
<br>
|
||||
|
||||
<noscript>
|
||||
@ -14,6 +14,6 @@ Laster inn...
|
||||
<script src="../static/js/ResultService.js"></script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
new ResultService(alertBox, rankingTable, '../api/v1/race/sync.php?h=');
|
||||
new ResultService(alertBox, rankingTable, '../api/race/results.php?h=');
|
||||
});
|
||||
</script>
|
@ -38,7 +38,7 @@
|
||||
<h4>Felles</h4>
|
||||
<ul>
|
||||
<li><a href="<?=$this->config['root_url']?>index.php">Forside</a></li>
|
||||
<li><a href="<?=$this->config['root_url']?>race/resultservice.php">Resultater</a></li>
|
||||
<li><a href="<?=$this->config['root_url']?>race/results.php">Resultater</a></li>
|
||||
</ul>
|
||||
|
||||
<?php if ($this->user->logged_in): ?>
|
||||
|
@ -1,12 +1,10 @@
|
||||
<?php $app = require '../../../../app/inc.php';
|
||||
<?php $app = require '../../../app/inc.php';
|
||||
/**
|
||||
* We originally wanted to use SSE for this, but the hosting provider
|
||||
* did not support that so we resorted to simple polling instead
|
||||
*
|
||||
* This page compiles a set of times and sends it if the provided hash of
|
||||
* the data is not equal.
|
||||
*
|
||||
* TODO: This code fucking sucks, all of it does
|
||||
*/
|
||||
|
||||
use App\Teamtable\TeamMapper;
|
5
public/race/results.php
Normal file
5
public/race/results.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php $app = require '../../app/inc.php';
|
||||
|
||||
$app->view('template/header', ["title" => "Resultater"]);
|
||||
$app->view('pages/race/results');
|
||||
$app->view('template/footer');
|
@ -1,5 +0,0 @@
|
||||
<?php $app = require '../../app/inc.php';
|
||||
|
||||
$app->view('template/header', ["title" => "Resultatservice"]);
|
||||
$app->view('pages/race/resultservice');
|
||||
$app->view('template/footer');
|
@ -39,6 +39,7 @@ class ResultService
|
||||
this.hash = json.hash;
|
||||
|
||||
let data = json.data;
|
||||
data.times = data.times.reverse();
|
||||
|
||||
let tableHTML = "";
|
||||
tableHTML += "<table>";
|
||||
@ -49,8 +50,9 @@ class ResultService
|
||||
tableHTML += "</tr>";
|
||||
|
||||
let iterator = 0;
|
||||
data.times.reverse().forEach(element => {
|
||||
data.times.forEach(element => {
|
||||
iterator++;
|
||||
|
||||
tableHTML += "<tr>";
|
||||
tableHTML += "<td>" + iterator + "</td>";
|
||||
tableHTML += "<td>" + data.map.team.name[element.id] + "</td>";
|
||||
|
Reference in New Issue
Block a user