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) }