Translated and added comments and prints

This commit is contained in:
Felix Kirchner
2025-04-22 15:45:48 +02:00
parent 5243812db5
commit f8c6edc927
2 changed files with 10 additions and 8 deletions

View File

@@ -100,12 +100,12 @@ class _ActiveGameViewState extends State<ActiveGameView> {
); );
} }
/// Returns a list of player indices sorted by their scores in
/// ascending order.
List<int> _getSortedPlayerIndices() { List<int> _getSortedPlayerIndices() {
// Erstelle eine Liste von Indizes der Spieler
List<int> playerIndices = List<int> playerIndices =
List<int>.generate(widget.gameSession.players.length, (index) => index); List<int>.generate(widget.gameSession.players.length, (index) => index);
// Sortiere die Indizes basierend auf den summierten Punkten // Sort the indices based on the summed points
// (playerScores[i][0])
playerIndices.sort((a, b) { playerIndices.sort((a, b) {
int scoreA = widget.gameSession.playerScores[a][0]; int scoreA = widget.gameSession.playerScores[a][0];
int scoreB = widget.gameSession.playerScores[b][0]; int scoreB = widget.gameSession.playerScores[b][0];
@@ -114,6 +114,9 @@ class _ActiveGameViewState extends State<ActiveGameView> {
return playerIndices; 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) { Widget _getPlacementPrefix(int index) {
switch (index) { switch (index) {
case 0: case 0:

View File

@@ -40,12 +40,11 @@ class _RoundViewState extends State<RoundView> {
@override @override
void initState() { void initState() {
print('Runde ${widget.roundNumber} geöffnet'); print('Runde ${widget.roundNumber} geöffnet');
print('Abgeschlossene Runden: ' print('Neuste Runde: ${widget.gameSession.playerScores[0].length}');
'${widget.gameSession.playerScores[0].length - 1}');
print('Aktuelle Runde: ${widget.gameSession.round}');
if (widget.gameSession.round < 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 ' print('Die Runde ${widget.gameSession.round} ist kleiner als die neuste '
'somit kleiner als die Runde ${widget.gameSession.round}'); 'Runde ${widget.gameSession.playerScores[0].length}, somit werden '
'die bereits eingetragenen Punkte angezeigt.');
// If the current round has already been played, the text fields // If the current round has already been played, the text fields
// are filled with the scores from this round // are filled with the scores from this round