From f8c6edc927ce33b32a6f098912572ed31c171091 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Tue, 22 Apr 2025 15:45:48 +0200 Subject: [PATCH] Translated and added comments and prints --- lib/views/active_game_view.dart | 9 ++++++--- lib/views/round_view.dart | 9 ++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/views/active_game_view.dart b/lib/views/active_game_view.dart index 00a7370..fe342d3 100644 --- a/lib/views/active_game_view.dart +++ b/lib/views/active_game_view.dart @@ -100,12 +100,12 @@ class _ActiveGameViewState extends State { ); } + /// Returns a list of player indices sorted by their scores in + /// ascending order. List _getSortedPlayerIndices() { - // Erstelle eine Liste von Indizes der Spieler List playerIndices = List.generate(widget.gameSession.players.length, (index) => index); - // Sortiere die Indizes basierend auf den summierten Punkten - // (playerScores[i][0]) + // Sort the indices based on the summed points playerIndices.sort((a, b) { int scoreA = widget.gameSession.playerScores[a][0]; int scoreB = widget.gameSession.playerScores[b][0]; @@ -114,6 +114,9 @@ class _ActiveGameViewState extends State { return playerIndices; } + /// Returns a widget that displays the placement prefix based on the index. + /// First three places are represented by medals, and the rest are numbered. + /// [index] is the index of the player in the descending sorted list. Widget _getPlacementPrefix(int index) { switch (index) { case 0: diff --git a/lib/views/round_view.dart b/lib/views/round_view.dart index 9d137d8..804d5c6 100644 --- a/lib/views/round_view.dart +++ b/lib/views/round_view.dart @@ -40,12 +40,11 @@ class _RoundViewState extends State { @override void initState() { print('Runde ${widget.roundNumber} geöffnet'); - print('Abgeschlossene Runden: ' - '${widget.gameSession.playerScores[0].length - 1}'); - print('Aktuelle Runde: ${widget.gameSession.round}'); + print('Neuste Runde: ${widget.gameSession.playerScores[0].length}'); if (widget.gameSession.round < widget.gameSession.playerScores[0].length) { - print('Die Länge ist ${widget.gameSession.playerScores[0].length} und ' - 'somit kleiner als die Runde ${widget.gameSession.round}'); + print('Die Runde ${widget.gameSession.round} ist kleiner als die neuste ' + 'Runde ${widget.gameSession.playerScores[0].length}, somit werden ' + 'die bereits eingetragenen Punkte angezeigt.'); // If the current round has already been played, the text fields // are filled with the scores from this round