Lots of changes and fixes

This commit is contained in:
2025-03-24 23:23:29 +00:00
parent 09b2ad8c56
commit d2013ec5c5
9 changed files with 116 additions and 54 deletions

View File

@@ -3,6 +3,7 @@ package handlers
import (
"log"
"net/http"
"synlotto-website/helpers"
"synlotto-website/models"
)
@@ -36,22 +37,22 @@ func Submit(w http.ResponseWriter, r *http.Request) {
log.Println("📝 Form submission received")
r.ParseForm()
draw := models.Draw{
Date: r.FormValue("date"),
draw := models.ThunderballResult{
DrawDate: r.FormValue("date"),
Machine: r.FormValue("machine"),
Ballset: r.FormValue("ballset"),
Ball1: r.FormValue("ball1"),
Ball2: r.FormValue("ball2"),
Ball3: r.FormValue("ball3"),
Ball4: r.FormValue("ball4"),
Ball5: r.FormValue("ball5"),
Thunderball: r.FormValue("thunderball"),
Ballset: helpers.Atoi(r.FormValue("ballset")),
Ball1: helpers.Atoi(r.FormValue("ball1")),
Ball2: helpers.Atoi(r.FormValue("ball2")),
Ball3: helpers.Atoi(r.FormValue("ball3")),
Ball4: helpers.Atoi(r.FormValue("ball4")),
Ball5: helpers.Atoi(r.FormValue("ball5")),
Thunderball: helpers.Atoi(r.FormValue("thunderball")),
}
Draws = append(Draws, draw)
log.Printf("📅 %s | 🛠 %s | 🎱 %s | 🔢 %s,%s,%s,%s,%s | ⚡ %s\n",
draw.Date, draw.Machine, draw.Ballset,
log.Printf("📅 %s | 🛠 %s | 🎱 %d | 🔢 %d,%d,%d,%d,%d | ⚡ %d\n",
draw.DrawDate, draw.Machine, draw.Ballset,
draw.Ball1, draw.Ball2, draw.Ball3, draw.Ball4, draw.Ball5, draw.Thunderball)
http.Redirect(w, r, "/", http.StatusSeeOther)