diff --git a/lib/data/dao/score_entry_dao.dart b/lib/data/dao/score_entry_dao.dart index d59f40a..830135d 100644 --- a/lib/data/dao/score_entry_dao.dart +++ b/lib/data/dao/score_entry_dao.dart @@ -276,13 +276,7 @@ class ScoreEntryDao extends DatabaseAccessor /// Returns `true` if the winner was removed, `false` if there are multiple /// scores or if the winner cannot be removed. Future removeWinner({required String matchId}) async { - final scores = await getAllMatchScores(matchId: matchId); - - if (scores.length > 1) { - return false; - } else { - return await deleteAllScoresForMatch(matchId: matchId); - } + return await deleteAllScoresForMatch(matchId: matchId); } /* multiple winners handling */ @@ -320,13 +314,6 @@ class ScoreEntryDao extends DatabaseAccessor return true; } - /// Removes the winners of a match. - /// - /// Returns `true` if more than 0 rows were affected, `false` otherwise. - Future removeWinners({required String matchId}) async { - return await deleteAllScoresForMatch(matchId: matchId); - } - /* Loser handling */ Future hasLoser({required String matchId}) async { diff --git a/lib/presentation/views/main_menu/match_view/match_result_view.dart b/lib/presentation/views/main_menu/match_view/match_result_view.dart index d14c259..ad41a09 100644 --- a/lib/presentation/views/main_menu/match_view/match_result_view.dart +++ b/lib/presentation/views/main_menu/match_view/match_result_view.dart @@ -444,7 +444,7 @@ class _MatchResultViewState extends State { /// Handles saving the (multiple) winners to the database. Future _handleWinners() async { if (_selectedWinners.isEmpty) { - return await db.scoreEntryDao.removeWinners(matchId: widget.match.id); + return await db.scoreEntryDao.removeWinner(matchId: widget.match.id); } else { return await db.scoreEntryDao.setWinners( matchId: widget.match.id,