Fix for tim.Time change to tickets model includes date helper.

This commit is contained in:
2025-10-29 10:00:58 +00:00
parent eba25a4fb5
commit 34918d770f
4 changed files with 75 additions and 10 deletions

View File

@@ -145,16 +145,24 @@ func SyndicateLogTicketHandler(app *bootstrap.App) http.HandlerFunc {
case http.MethodPost:
gameType := r.FormValue("game_type")
drawDate := r.FormValue("draw_date")
drawDateStr := r.FormValue("draw_date")
method := r.FormValue("purchase_method")
err := ticketStorage.InsertTicket(app.DB, models.Ticket{
dt, err := helpers.ParseDrawDate(drawDateStr)
if err != nil {
templateHelpers.SetFlash(r, "Invalid draw date")
http.Redirect(w, r, fmt.Sprintf("/syndicate/view?id=%d", syndicateId), http.StatusSeeOther)
return
}
err = ticketStorage.InsertTicket(app.DB, models.Ticket{
UserId: userID,
GameType: gameType,
DrawDate: drawDate,
DrawDate: dt,
PurchaseMethod: method,
SyndicateId: &syndicateId,
})
if err != nil {
templateHelpers.SetFlash(r, "Failed to add ticket.")
} else {