From 74402f2e04de52ef7e32d8ca6740b9cbefd2cd10 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Sun, 16 Nov 2025 19:02:20 +0100 Subject: [PATCH] Added fallbacks for players when same player already exists --- lib/data/dao/player_dao.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/data/dao/player_dao.dart b/lib/data/dao/player_dao.dart index 976d4b0..591634c 100644 --- a/lib/data/dao/player_dao.dart +++ b/lib/data/dao/player_dao.dart @@ -26,14 +26,14 @@ class PlayerDao extends DatabaseAccessor with _$PlayerDaoMixin { /// Adds a new [player] to the database. /// If a player with the same ID already exists, updates their name to /// the new one. - Future addPlayer({required Player player}) async { + Future addPlayer({required Player player}) async { if (!await playerExists(playerId: player.id)) { await into( playerTable, ).insert(PlayerTableCompanion.insert(id: player.id, name: player.name)); - } else { - await updatePlayername(playerId: player.id, newName: player.name); + return true; } + return false; } /// Deletes the player with the given [id] from the database.