add TEMPORARY winner getter and setter methods to match_dao.dart
Some checks failed
Pull Request Pipeline / test (pull_request) Failing after 1m57s
Pull Request Pipeline / lint (pull_request) Failing after 3m32s

This commit is contained in:
gelbeinhalb
2026-01-16 13:44:03 +01:00
parent 40e970a5dc
commit 49e990dfea

View File

@@ -339,4 +339,40 @@ class MatchDao extends DatabaseAccessor<AppDatabase> with _$MatchDaoMixin {
); );
return rowsAffected > 0; return rowsAffected > 0;
} }
// ============================================================
// TEMPORARY: Winner methods - these are stubs and do not persist data
// TODO: Implement proper winner handling
// ============================================================
/// TEMPORARY: Checks if a match has a winner.
/// Currently returns true if the match has any players.
Future<bool> hasWinner({required String matchId}) async {
final players = await db.playerMatchDao.getPlayersOfMatch(matchId: matchId);
return players?.isNotEmpty ?? false;
}
/// TEMPORARY: Gets the winner of a match.
/// Currently returns the first player in the match's player list.
Future<Player?> getWinner({required String matchId}) async {
final players = await db.playerMatchDao.getPlayersOfMatch(matchId: matchId);
return (players?.isNotEmpty ?? false) ? players!.first : null;
}
/// TEMPORARY: Sets the winner of a match.
/// Currently does nothing - winner is not persisted.
Future<bool> setWinner({
required String matchId,
required String winnerId,
}) async {
// TODO: Implement winner persistence
return true;
}
/// TEMPORARY: Removes the winner of a match.
/// Currently does nothing - winner is not persisted.
Future<bool> removeWinner({required String matchId}) async {
// TODO: Implement winner persistence
return true;
}
} }