From 49e990dfea7b496db0a097fb9850d43466fa66dc Mon Sep 17 00:00:00 2001 From: gelbeinhalb Date: Fri, 16 Jan 2026 13:44:03 +0100 Subject: [PATCH] add TEMPORARY winner getter and setter methods to match_dao.dart --- lib/data/dao/match_dao.dart | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/lib/data/dao/match_dao.dart b/lib/data/dao/match_dao.dart index 0c16a6b..696aff7 100644 --- a/lib/data/dao/match_dao.dart +++ b/lib/data/dao/match_dao.dart @@ -339,4 +339,40 @@ class MatchDao extends DatabaseAccessor with _$MatchDaoMixin { ); 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 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 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 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 removeWinner({required String matchId}) async { + // TODO: Implement winner persistence + return true; + } }