Lots of changes, still more to do
This commit is contained in:
21
services/admin/manualtriggers.go
Normal file
21
services/admin/manualtriggers.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"synlotto-website/services"
|
||||
)
|
||||
|
||||
var db *sql.DB
|
||||
|
||||
func AdminMatchHandler(w http.ResponseWriter, r *http.Request) {
|
||||
stats, err := services.RunTicketMatching(db, "manual")
|
||||
if err != nil {
|
||||
http.Error(w, "Matching failed: "+err.Error(), 500)
|
||||
return
|
||||
}
|
||||
http.Redirect(w, r, "/admin?flash=Matched "+
|
||||
strconv.Itoa(stats.TicketsMatched)+" tickets, "+
|
||||
strconv.Itoa(stats.WinnersFound)+" winners.", http.StatusSeeOther)
|
||||
}
|
||||
Reference in New Issue
Block a user