Make sure newly generated IDs don't interefere with the hibernated games.
This commit is contained in:
parent
ac050fc505
commit
6a0536761c
1 changed files with 3 additions and 3 deletions
|
|
@ -1,10 +1,10 @@
|
||||||
import { Team } from "./Team";
|
import { Team } from "./Team";
|
||||||
import { Deck } from "./Deck";
|
import { Deck } from "./Deck";
|
||||||
|
import { readFile } from "fs";
|
||||||
import neatCSV from "neat-csv";
|
import neatCSV from "neat-csv";
|
||||||
import { Logger } from "tslog";
|
import { Logger } from "tslog";
|
||||||
import { games } from "../main";
|
|
||||||
import { Player } from "./Player";
|
import { Player } from "./Player";
|
||||||
import { readFile } from "fs";
|
import { games, hibernatedGames } from "../main";
|
||||||
|
|
||||||
export class Game {
|
export class Game {
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
|
|
@ -135,7 +135,7 @@ export class Game {
|
||||||
for (var i = 0; i < length; i++) {
|
for (var i = 0; i < length; i++) {
|
||||||
code += `${Math.floor(Math.random() * 9)}`;
|
code += `${Math.floor(Math.random() * 9)}`;
|
||||||
};
|
};
|
||||||
} while (games[code]);
|
} while (games[code] || hibernatedGames.includes(code));
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue