Refactoring
All checks were successful
Pull Request Pipeline / test (pull_request) Successful in 45s
Pull Request Pipeline / lint (pull_request) Successful in 47s

This commit is contained in:
2026-05-02 01:31:49 +02:00
parent 9e4f44491c
commit 5789650c97
16 changed files with 83 additions and 83 deletions

View File

@@ -116,18 +116,18 @@ class PlayerMatchDao extends DatabaseAccessor<AppDatabase>
}
/// Updates the players associated with a match based on the provided
/// [newPlayer] list. It adds new players and removes players that are no
/// [player] list. It adds new players and removes players that are no
/// longer associated with the match.
Future<bool> updateMatchPlayers({
required String matchId,
required List<Player> newPlayer,
required List<Player> player,
}) async {
if (newPlayer.isEmpty) return false;
if (player.isEmpty) return false;
final currentPlayers = await getPlayersOfMatch(matchId: matchId);
// Create sets of player IDs for easy comparison
final currentPlayerIds = currentPlayers.map((p) => p.id).toSet();
final newPlayerIdsSet = newPlayer.map((p) => p.id).toSet();
final newPlayerIdsSet = player.map((p) => p.id).toSet();
// Are the current and new player identical?
if (currentPlayerIds.containsAll(newPlayerIdsSet) &&