Skip to content

Commit 1f8a6b1

Browse files
committed
fix gamestart bug on last game
1 parent c856f06 commit 1f8a6b1

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,12 @@ Building and running:
5656

5757
## frontend
5858
- new time system:
59-
- [ ] correctly handle pausing, unpausing and timeskipping
59+
- [x] correctly handle pausing, unpausing and timeskipping
6060
- [X] update UI accordingly
6161
- [X] change md struct
6262
- [ ] implement setting delay
6363
- [X] change time calculation logic
6464
- [ ] implement handshake
65-
- [ ] fix rendering of the last game at gamestart
66-
- BUG time reset führt zu 07:04 statt 07:00 (probably )
6765
- BUG Spielplan scrollt nur einmalig
6866
- CONSIDER frontend: zeit gelb, wenn HZpause
6967
- cards

frontend/script.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,10 @@ function write_gamestart() {
587587

588588
const default_col = "white";
589589

590-
const teams_cur = get_teams(md.games[md.meta.game.index] ?? null);
590+
console.log(md.games);
591+
console.log(md.meta);
592+
const teams_cur = get_teams(md.games[md.meta.game.index]);
593+
console.log(teams_cur);
591594
const left_col_cur = teams_cur[0]?.color ?? default_col;
592595
const right_col_cur = teams_cur[1]?.color ?? default_col;
593596

@@ -596,9 +599,9 @@ function write_gamestart() {
596599
const t2_keeper = teams_cur[1]?.players.find(p => p.role === "keeper")?.name ?? "[???]";
597600
const t2_field = teams_cur[1]?.players.find(p => p.role === "field")?.name ?? "[???]";
598601

599-
const teams_next = get_teams(md.games[md.meta.game.index + 1] ?? null);
600-
const left_col_next = teams_next[0]?.color ?? default_col;
601-
const right_col_next = teams_next[1]?.color ?? default_col;
602+
const teams_next = md.meta.game.index+1 < md.games.length ? get_teams(md.games[md.meta.game.index + 1]) : null;
603+
const left_col_next = teams_next?.[0]?.color ?? default_col;
604+
const right_col_next = teams_next?.[1]?.color ?? default_col;
602605

603606
const t1_name_el = document.createElement("div");
604607
t1_name_el.classList.add("bordered");
@@ -642,7 +645,7 @@ function write_gamestart() {
642645
gamestart_t2.appendChild(t2_keeper_el);
643646
gamestart_t2.appendChild(t2_field_el);
644647

645-
if (teams_next[0] == null && teams_next[1] == null) gamestart_next.style.display = "none";
648+
if (teams_next?.[0] == null && teams_next?.[1] == null) gamestart_next.style.display = "none";
646649
else {
647650
gamestart_next.style.display = "block";
648651
gamestart_next_t1.innerHTML = teams_next[0]?.name.toString() ?? "[???]";

0 commit comments

Comments
 (0)