Fix for tim.Time change to tickets model includes date helper.
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user