This commit is contained in:
parent
5cae25cb2f
commit
6883ce679e
8
main.go
8
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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user