Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
feat(live-feed): show the tournament name in tournament mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Reed committed Nov 17, 2020
1 parent ee56faf commit 0c9be3a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/app/live-feed/live-feed.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,11 @@ export class LiveFeedPage implements OnInit, OnDestroy {
uiState.countdownNotice = '';
break;
}
case PHASES.TOURNAMENT_PLAY:
{
uiState.seasonHeader = this.streamData?.games?.tournament?.name;
break;
}
default:
uiState.seasonHeader = `Season ${this.streamData?.games?.season?.seasonNumber}, Day ${day}`;
break;
Expand Down
5 changes: 5 additions & 0 deletions src/lib/model/games.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Game } from './game';
import { Entry, ID } from './_entry';
import { Matchup } from './matchup';
import { PHASES } from './phases';
import { Tournament } from './tournament';

export class Games extends Entry {
public get sim(): Sim {
Expand All @@ -32,6 +33,10 @@ export class Games extends Entry {
return new Postseason(this.data?.postseason);
}

public get tournament(): Tournament {
return new Tournament(this.data?.tournament);
}

private isPreseason(now = Date.now()) {
const nextSeason = new Date(this.sim?.data?.nextSeasonStart).getTime();
// console.debug(`nextSeason=${nextSeason}, now=${now}`);
Expand Down
29 changes: 29 additions & 0 deletions src/lib/model/tournament.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Entry, ID } from './_entry';

export class Tournament extends Entry {
public id: ID;
public description: string;
public finalsName: string;
public index: number;
public name: string;
public playoffs: ID;

constructor(data?: any) {
super(data);

this.defineStrings([
'id',
'description',
'finalsName',
'name',
'playoffs',
]);
this.defineNumbers([
'index',
]);
}

public get teams(): ID[] {
return this.data?.teams || [];
}
}

0 comments on commit 0c9be3a

Please sign in to comment.