From 58fe1dbc4d28fc16cdab44ada002368f77a57fa1 Mon Sep 17 00:00:00 2001 From: Andreas Neue Date: Mon, 23 Jan 2017 14:57:41 +0100 Subject: [PATCH] fixed ranklist bug --- modules/quiz.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/quiz.go b/modules/quiz.go index 707c111..0315484 100644 --- a/modules/quiz.go +++ b/modules/quiz.go @@ -102,20 +102,21 @@ func quizPrintRanklist(ranklist map[string]int) { if len(ranklist) == 0 { return } + ranklistTmp = copy(ranklist) SayCh <- fmt.Sprintf("%s\nAktueller Punktestand:", "*") for { maxk := "" maxv := -1 - if len(ranklist) == 0 { + if len(ranklistTmp) == 0 { break } - for k, v := range ranklist { + for k, v := range ranklistTmp { if v > maxv { maxv = v maxk = k } } - delete(ranklist, maxk) + delete(ranklistTmp, maxk) SayCh <- fmt.Sprintf("%s\n%s: %d", "*", maxk, maxv) } }