fix: updating team score in detail view
Some checks failed
Pull Request Pipeline / lint (pull_request) Successful in 55s
Pull Request Pipeline / test (pull_request) Failing after 10m49s

This commit is contained in:
2026-05-18 00:48:29 +02:00
parent 0a1e14a32d
commit 9bce03d780
5 changed files with 80 additions and 49 deletions

View File

@@ -124,6 +124,24 @@ class TeamDao extends DatabaseAccessor<AppDatabase> with _$TeamDaoMixin {
);
}
Future<List<Team>> getTeamsByMatchId({required String matchId}) async {
final playerMatchQuery = select(db.playerMatchTable)
..where((pm) => pm.matchId.equals(matchId));
final playerMatches = await playerMatchQuery.get();
if (playerMatches.isEmpty) return [];
final teamIds = playerMatches
.map((pm) => pm.teamId)
.whereType<String>()
.toSet();
final teams = await Future.wait(
teamIds.map((id) => getTeamById(teamId: id)),
);
return teams;
}
/// Retrieves a [Team] by its [teamId], including its members.
Future<Team> getTeamById({required String teamId}) async {
final query = select(teamTable)..where((t) => t.id.equals(teamId));

View File

@@ -19,7 +19,7 @@ class Match {
final bool isTeamMatch;
final List<Team>? teams;
final String notes;
Map<String, ScoreEntry?> scores;
final Map<String, ScoreEntry?> scores;
Match({
required this.name,