Added shome shit to invert who is home and away.
This commit is contained in:
1 parent
3bc18baa30
commit
514bb0ac47
3 files changed
+40
No files matched your search
@@ -173,6 +173,23 @@ export class GameService {
|
||||
return res.ok;
|
||||
}
|
||||
|
||||
async switchVisitors(id: string): Promise<boolean> {
|
||||
const game = await this.getGameById(id);
|
||||
if (game === null) {
|
||||
return false;
|
||||
}
|
||||
delete game.id;
|
||||
const [home, away] = [game.home, game.away];
|
||||
const [homeScore, awayScore] = [game.homeScore, game.awayScore];
|
||||
game.home = away;
|
||||
game.away = home;
|
||||
game.homeScore = awayScore;
|
||||
game.awayScore = homeScore;
|
||||
console.log(`game ${game}`);
|
||||
|
||||
return this.updateGame(id, game);
|
||||
}
|
||||
|
||||
async updateGame(id: string, partial: Partial<Game>): Promise<boolean> {
|
||||
delete partial.id;
|
||||
const precond = await this.kv.get<Game>(this.gamePrimaryKey(id));
|
||||
|
||||
Reference in new issue
Block a user