Fixed test issues
Some checks failed
Pull Request Pipeline / test (pull_request) Failing after 46s
Pull Request Pipeline / lint (pull_request) Successful in 48s

This commit is contained in:
2026-05-01 18:01:07 +02:00
parent 0f2e3493c4
commit ab9a8d0193
3 changed files with 67 additions and 39 deletions

View File

@@ -42,11 +42,24 @@ class MatchDao extends DatabaseAccessor<AppDatabase> with _$MatchDaoMixin {
await db.teamDao.addTeamsAsList(teams: match.teams!, matchId: match.id);
}
// Collect all player IDs that are already in teams
final playersInTeams = <String>{};
if (match.teams != null) {
for (final team in match.teams!) {
for (final member in team.members) {
playersInTeams.add(member.id);
}
}
}
// Add players that are not in teams
for (final p in match.players) {
await db.playerMatchDao.addPlayerToMatch(
matchId: match.id,
playerId: p.id,
);
if (!playersInTeams.contains(p.id)) {
await db.playerMatchDao.addPlayerToMatch(
matchId: match.id,
playerId: p.id,
);
}
}
for (final pid in match.scores.keys) {