Skip to content

Commit

Permalink
show if we're home or way
Browse files Browse the repository at this point in the history
home = heim
away = auswärts
  • Loading branch information
Aethese committed Sep 29, 2023
1 parent 463a285 commit aaeb8e3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
20 changes: 15 additions & 5 deletions get_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async function getData(team, game)
});
let data = await response.json();

// order is the same as it is on the table
// order is the same as it is on the table!! \\

// only get the simplified date
let date = data[game-1]['matchDateTime'].substring(0, 10);
Expand All @@ -99,6 +99,15 @@ async function getData(team, game)
enemyTeamName = 'Dortmund';
}

// check if we're home or away
let ha;
if (team1)
{
ha = 'H';
} else {
ha = 'A';
}

let matchResults = data[game-1]['matchResults'][1];
let score;
let score1 = matchResults['pointsTeam1'];
Expand All @@ -113,9 +122,9 @@ async function getData(team, game)
let BLTable = await getBLTable(team);

finalInfo = [
game, date, enemyTeamName, score,
BLTable[0], BLTable[1], BLTable[2],
BLTable[3], BLTable[4],
ha, game, date, enemyTeamName,
score, BLTable[0], BLTable[1],
BLTable[2], BLTable[3], BLTable[4],
];
return finalInfo;
}
Expand All @@ -134,6 +143,7 @@ async function updateTable(team, game)

// don't know a better way to do this at this
// moment in time :)
let ha = document.getElementById('ha');
let spielt = document.getElementById('spielt');
let datum = document.getElementById('datum');
let gegner = document.getElementById('gegner');
Expand All @@ -145,7 +155,7 @@ async function updateTable(team, game)
let platz = document.getElementById('platz');

let itemList = [
spielt, datum, gegner, ergebnis,
ha, spielt, datum, gegner, ergebnis,
guv, tore, diff, punkte, platz
];

Expand Down
4 changes: 3 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ <h3 id='selectedG' class='hidden'>Dein gewähltes Spiel ist: 0</h3>

<table id='dataTable' class='hidden'>
<tr> <!-- header -->
<th>Spielt</th>
<th>H/A</th> <!-- Heim/Auswärts -->
<th>Spieltag</th>
<th>Datum (JAHR-MM-TT)</th>
<th>Gegner</th>
<th class='text-center'>Ergebnis</th>
Expand All @@ -53,6 +54,7 @@ <h3 id='selectedG' class='hidden'>Dein gewähltes Spiel ist: 0</h3>
<th style='text-align: right;'>Platz</th>
</tr>
<tr> <!-- actual data -->
<th id='ha'>Heim</th>
<th id='spielt'>0</th>
<th id='datum'>2023/01/01</th>
<th id='gegner'>Default</th>
Expand Down

0 comments on commit aaeb8e3

Please sign in to comment.