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:
		@@ -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