implement setPlacement in Score Dao & add placement game type to match tile
All checks were successful
Pull Request Pipeline / test (pull_request) Successful in 48s
Pull Request Pipeline / lint (pull_request) Successful in 49s

This commit is contained in:
2026-05-09 18:19:30 +02:00
parent 616c239375
commit 79ce3efd0a
3 changed files with 23 additions and 14 deletions

View File

@@ -353,4 +353,19 @@ class ScoreEntryDao extends DatabaseAccessor<AppDatabase>
return await deleteAllScoresForMatch(matchId: matchId);
}
}
/// Sets the placement for each player in a match.
/// The highest score is assigned to the first player, the second highest to the second player, and so on.
Future<void> setPlacements({
required String matchId,
required List<Player> players,
}) async {
for (int i = 0; i < players.length; i++) {
await db.scoreEntryDao.addScore(
matchId: matchId,
playerId: players[i].id,
entry: ScoreEntry(roundNumber: 0, score: players.length - i, change: 0),
);
}
}
}