Moved dao methods

This commit is contained in:
2026-04-08 23:22:33 +02:00
parent e10f05adb5
commit 855b7c8bea
8 changed files with 155 additions and 148 deletions

View File

@@ -227,7 +227,7 @@ class _HomeViewState extends State<HomeView> {
/// Updates the winner information for a specific match in the recent matches list.
Future<void> updatedWinnerInRecentMatches(String matchId) async {
final db = Provider.of<AppDatabase>(context, listen: false);
final winner = await db.matchDao.getWinner(matchId: matchId);
final winner = await db.scoreDao.getWinner(matchId: matchId);
final matchIndex = recentMatches.indexWhere((match) => match.id == matchId);
if (matchIndex != -1) {
setState(() {

View File

@@ -139,11 +139,11 @@ class _MatchResultViewState extends State<MatchResultView> {
/// based on the current selection.
Future<void> _handleWinnerSaving() async {
if (_selectedPlayer == null) {
await db.matchDao.removeWinner(matchId: widget.match.id);
await db.scoreDao.removeWinner(matchId: widget.match.id);
} else {
await db.matchDao.setWinner(
await db.scoreDao.setWinner(
matchId: widget.match.id,
winnerId: _selectedPlayer!.id,
playerId: _selectedPlayer!.id,
);
}
widget.onWinnerChanged?.call();