Lots of changes around viewing tickets from css perspective logic changes nwe handlers and service triggers... just lots of stuff...
This commit is contained in:
29
services/draws/drawlookup.go
Normal file
29
services/draws/drawlookup.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"log"
|
||||
"synlotto-website/models"
|
||||
)
|
||||
|
||||
func GetDrawResultForTicket(db *sql.DB, game string, drawDate string) models.DrawResult {
|
||||
var result models.DrawResult
|
||||
query := `
|
||||
SELECT id, ball1, ball2, ball3, ball4, ball5, bonus1
|
||||
FROM results_thunderball
|
||||
WHERE draw_date = ?
|
||||
`
|
||||
var b1, b2, b3, b4, b5, bonus sql.NullInt64
|
||||
err := db.QueryRow(query, drawDate).Scan(&result.DrawID, &b1, &b2, &b3, &b4, &b5, &bonus)
|
||||
if err != nil {
|
||||
log.Printf("No draw found for %s %s: %v", game, drawDate, err)
|
||||
return result
|
||||
}
|
||||
result.GameType = game
|
||||
result.DrawDate = drawDate
|
||||
result.Balls = []int{int(b1.Int64), int(b2.Int64), int(b3.Int64), int(b4.Int64), int(b5.Int64)}
|
||||
if bonus.Valid {
|
||||
result.BonusBalls = []int{int(bonus.Int64)}
|
||||
}
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user