Refactored jackpot handling and updated dependencies
Replaced `currency.Amount` with `int` for jackpot values to simplify representation. Adjusted parsing logic accordingly. Updated Go version to 1.24.0 and refreshed dependencies in go.mod for compatibility.
This commit is contained in:
10
go.mod
10
go.mod
@@ -1,12 +1,14 @@
|
||||
module gitea.stevedudenhoeffer.com/steve/go-extractor
|
||||
|
||||
go 1.23.2
|
||||
go 1.24.0
|
||||
|
||||
toolchain go1.24.1
|
||||
|
||||
require (
|
||||
github.com/go-shiori/go-readability v0.0.0-20250217085726-9f5bf5ca7612
|
||||
github.com/playwright-community/playwright-go v0.5001.0
|
||||
github.com/playwright-community/playwright-go v0.5200.0
|
||||
github.com/urfave/cli/v3 v3.0.0-beta1
|
||||
golang.org/x/text v0.23.0
|
||||
golang.org/x/text v0.29.0
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -17,5 +19,5 @@ require (
|
||||
github.com/go-shiori/dom v0.0.0-20230515143342-73569d674e1c // indirect
|
||||
github.com/go-stack/stack v1.8.1 // indirect
|
||||
github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f // indirect
|
||||
golang.org/x/net v0.37.0 // indirect
|
||||
golang.org/x/net v0.44.0 // indirect
|
||||
)
|
||||
|
@@ -9,8 +9,6 @@ import (
|
||||
"time"
|
||||
|
||||
"gitea.stevedudenhoeffer.com/steve/go-extractor"
|
||||
|
||||
"golang.org/x/text/currency"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
@@ -30,8 +28,8 @@ type Drawing struct {
|
||||
}
|
||||
|
||||
type NextDrawing struct {
|
||||
Date string
|
||||
Jackpot currency.Amount
|
||||
Date string
|
||||
JackpotDollars int
|
||||
}
|
||||
|
||||
func deferClose(cl io.Closer) {
|
||||
@@ -165,16 +163,15 @@ func getNextDrawing(_ context.Context, doc extractor.Document) (*NextDrawing, er
|
||||
|
||||
set := false
|
||||
if strings.Contains(txt, "Billion") {
|
||||
amt := currency.USD.Amount(numeric * 1000000000)
|
||||
nextDrawing.Jackpot = amt
|
||||
amt := numeric * 1000000000
|
||||
nextDrawing.JackpotDollars = int(amt)
|
||||
set = true
|
||||
} else if strings.Contains(txt, "Million") {
|
||||
amt := currency.USD.Amount(numeric * 1000000)
|
||||
nextDrawing.Jackpot = amt
|
||||
amt := numeric * 1000000
|
||||
nextDrawing.JackpotDollars = int(amt)
|
||||
set = true
|
||||
} else {
|
||||
amt := currency.USD.Amount(numeric)
|
||||
nextDrawing.Jackpot = amt
|
||||
nextDrawing.JackpotDollars = int(numeric)
|
||||
set = true
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user