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
|
module gitea.stevedudenhoeffer.com/steve/go-extractor
|
||||||
|
|
||||||
go 1.23.2
|
go 1.24.0
|
||||||
|
|
||||||
|
toolchain go1.24.1
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/go-shiori/go-readability v0.0.0-20250217085726-9f5bf5ca7612
|
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
|
github.com/urfave/cli/v3 v3.0.0-beta1
|
||||||
golang.org/x/text v0.23.0
|
golang.org/x/text v0.29.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
@@ -17,5 +19,5 @@ require (
|
|||||||
github.com/go-shiori/dom v0.0.0-20230515143342-73569d674e1c // indirect
|
github.com/go-shiori/dom v0.0.0-20230515143342-73569d674e1c // indirect
|
||||||
github.com/go-stack/stack v1.8.1 // indirect
|
github.com/go-stack/stack v1.8.1 // indirect
|
||||||
github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f // 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"
|
"time"
|
||||||
|
|
||||||
"gitea.stevedudenhoeffer.com/steve/go-extractor"
|
"gitea.stevedudenhoeffer.com/steve/go-extractor"
|
||||||
|
|
||||||
"golang.org/x/text/currency"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
@@ -30,8 +28,8 @@ type Drawing struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type NextDrawing struct {
|
type NextDrawing struct {
|
||||||
Date string
|
Date string
|
||||||
Jackpot currency.Amount
|
JackpotDollars int
|
||||||
}
|
}
|
||||||
|
|
||||||
func deferClose(cl io.Closer) {
|
func deferClose(cl io.Closer) {
|
||||||
@@ -165,16 +163,15 @@ func getNextDrawing(_ context.Context, doc extractor.Document) (*NextDrawing, er
|
|||||||
|
|
||||||
set := false
|
set := false
|
||||||
if strings.Contains(txt, "Billion") {
|
if strings.Contains(txt, "Billion") {
|
||||||
amt := currency.USD.Amount(numeric * 1000000000)
|
amt := numeric * 1000000000
|
||||||
nextDrawing.Jackpot = amt
|
nextDrawing.JackpotDollars = int(amt)
|
||||||
set = true
|
set = true
|
||||||
} else if strings.Contains(txt, "Million") {
|
} else if strings.Contains(txt, "Million") {
|
||||||
amt := currency.USD.Amount(numeric * 1000000)
|
amt := numeric * 1000000
|
||||||
nextDrawing.Jackpot = amt
|
nextDrawing.JackpotDollars = int(amt)
|
||||||
set = true
|
set = true
|
||||||
} else {
|
} else {
|
||||||
amt := currency.USD.Amount(numeric)
|
nextDrawing.JackpotDollars = int(numeric)
|
||||||
nextDrawing.Jackpot = amt
|
|
||||||
set = true
|
set = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user