Deleted local winner log, winner list length capped to 20
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Release / publish (push) Successful in 1m0s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Release / publish (push) Successful in 1m0s
				
			This commit is contained in:
		
							
								
								
									
										12
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								main.go
									
									
									
									
									
								
							| @@ -2,7 +2,6 @@ package main | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"log" |  | ||||||
| 	"math/rand" | 	"math/rand" | ||||||
| 	"net/http" | 	"net/http" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| @@ -34,10 +33,8 @@ func randomNumber(w http.ResponseWriter, r *http.Request) { | |||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
| 	won := randomize(chance, multiplicator) | 	won := randomize(chance, multiplicator) | ||||||
| 	log.Println(name) |  | ||||||
| 	if name != "" && won { | 	if name != "" && won { | ||||||
| 		winners = append(winners, name) | 		appendUser(name) | ||||||
| 		fmt.Println(winners) |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	fmt.Fprint(w, won) | 	fmt.Fprint(w, won) | ||||||
| @@ -65,3 +62,10 @@ func listWiners(w http.ResponseWriter, r *http.Request) { | |||||||
| 	} | 	} | ||||||
| 	fmt.Fprint(w, out) | 	fmt.Fprint(w, out) | ||||||
| } | } | ||||||
|  | func appendUser(username string) { | ||||||
|  | 	winners = append(winners, username) | ||||||
|  | 	if len(winners) > 20 { | ||||||
|  | 		winners = winners[1:] | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Gian Breitenstein
					Gian Breitenstein