From 6883ce679e446606372140ec7e000e9e632a2e61 Mon Sep 17 00:00:00 2001 From: Gian Breitenstein Date: Thu, 26 Sep 2024 18:24:40 +0200 Subject: [PATCH] formatted winners --- main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index d9e47e4..a81eb7a 100644 --- a/main.go +++ b/main.go @@ -30,7 +30,7 @@ func randomNumber(w http.ResponseWriter, r *http.Request) { } won := randomize(chance, multiplicator) log.Println(name) - if name != "" { + if name != "" && won { winners = append(winners, name) fmt.Println(winners) } @@ -54,5 +54,9 @@ func randomize(chance int, mult int) bool { } } func listWiners(w http.ResponseWriter, r *http.Request) { - fmt.Fprint(w, winners) + out := "" + for _, winner := range winners { + out += winner + "\n" + } + fmt.Fprint(w, out) }