Moved dao methods
This commit is contained in:
@@ -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(() {
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user