Adapted getTemporaryGame method

This commit is contained in:
2026-03-07 22:47:28 +01:00
parent 588b5053e8
commit 9d2b6a0286

View File

@@ -345,19 +345,6 @@ class _CreateMatchViewState extends State<CreateMatchView> {
Future<Game> getTemporaryGame() async { Future<Game> getTemporaryGame() async {
Game? game; Game? game;
// No game is selected
if (selectedGameIndex == -1) {
// Use the first game as default if none selected
final selectedGame = games[0];
game = Game(
name: selectedGame.$1,
description: selectedGame.$2,
ruleset: selectedGame.$3,
color: GameColor.blue,
icon: '',
);
} else {
// Use the selected game from the list
final selectedGame = games[selectedGameIndex]; final selectedGame = games[selectedGameIndex];
game = Game( game = Game(
name: selectedGame.$1, name: selectedGame.$1,
@@ -366,8 +353,7 @@ class _CreateMatchViewState extends State<CreateMatchView> {
color: GameColor.blue, color: GameColor.blue,
icon: '', icon: '',
); );
}
// Add the game to the database if it doesn't exist
await db.gameDao.addGame(game: game); await db.gameDao.addGame(game: game);
return game; return game;
} }