feat: implemented multiple winners with teams

This commit is contained in:
2026-05-18 22:25:49 +02:00
parent 0f621cd799
commit 0812f18d77
7 changed files with 182 additions and 84 deletions

View File

@@ -268,6 +268,21 @@ class TeamDao extends DatabaseAccessor<AppDatabase> with _$TeamDaoMixin {
return await updateTeamScore(teamId: teamId, matchId: matchId, score: 1);
}
Future<bool> setWinnerTeams({
required List<Team> winners,
required String matchId,
}) async {
List<bool?> success = List.generate(winners.length, (index) => null);
for (int i = 0; i < winners.length; i++) {
success[i] = await updateTeamScore(
teamId: winners[i].id,
matchId: matchId,
score: 1,
);
}
return success.every((result) => result == true);
}
Future<bool> removeWinnerTeam({
required String teamId,
required String matchId,