madness continues

This commit is contained in:
2025-03-28 13:04:53 +00:00
parent 23e0208317
commit cabc283673
12 changed files with 156 additions and 25 deletions

View File

@@ -11,6 +11,7 @@ import (
"strconv"
"synlotto-website/helpers"
"synlotto-website/models"
draws "synlotto-website/services/draws"
"time"
"github.com/gorilla/csrf"
@@ -312,8 +313,13 @@ func GetMyTickets(db *sql.DB) http.HandlerFunc {
continue
}
t.Ball1, t.Ball2, t.Ball3 = int(b1.Int64), int(b2.Int64), int(b3.Int64)
t.Ball4, t.Ball5, t.Ball6 = int(b4.Int64), int(b5.Int64), int(b6.Int64)
// Build primary number + bonus fields
t.Ball1 = int(b1.Int64)
t.Ball2 = int(b2.Int64)
t.Ball3 = int(b3.Int64)
t.Ball4 = int(b4.Int64)
t.Ball5 = int(b5.Int64)
t.Ball6 = int(b6.Int64)
t.Bonus1 = helpers.IntPtrIfValid(bo1)
t.Bonus2 = helpers.IntPtrIfValid(bo2)
@@ -330,9 +336,19 @@ func GetMyTickets(db *sql.DB) http.HandlerFunc {
t.IsWinner = isWinner.Bool
}
// Build balls slices (for template use)
t.Balls = helpers.BuildBallsSlice(t)
t.BonusBalls = helpers.BuildBonusSlice(t)
// 🎯 Get the actual draw info (used to show which numbers matched)
draw := draws.GetDrawResultForTicket(db, t.GameType, t.DrawDate)
t.MatchedDraw = draw
// ✅ DEBUG
log.Printf("✅ Ticket #%d", t.Id)
log.Printf("Balls: %v", t.Balls)
log.Printf("DrawResult: %+v", draw)
tickets = append(tickets, t)
}