Refactor and remove sqlite and replace with MySQL
This commit is contained in:
43
internal/rules/thunderball/rules.go
Normal file
43
internal/rules/thunderball/rules.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"synlotto-website/internal/models"
|
||||
"synlotto-website/internal/rules"
|
||||
)
|
||||
|
||||
var ThunderballPrizeRules = []models.PrizeRule{
|
||||
{Game: rules.GameThunderball, MainMatches: 0, BonusMatches: 1, Tier: "Tier 1"},
|
||||
{Game: rules.GameThunderball, MainMatches: 1, BonusMatches: 1, Tier: "Tier 2"},
|
||||
{Game: rules.GameThunderball, MainMatches: 2, BonusMatches: 1, Tier: "Tier 3"},
|
||||
{Game: rules.GameThunderball, MainMatches: 3, BonusMatches: 0, Tier: "Tier 4"},
|
||||
{Game: rules.GameThunderball, MainMatches: 3, BonusMatches: 1, Tier: "Tier 5"},
|
||||
{Game: rules.GameThunderball, MainMatches: 4, BonusMatches: 0, Tier: "Tier 6"},
|
||||
{Game: rules.GameThunderball, MainMatches: 4, BonusMatches: 1, Tier: "Tier 7"},
|
||||
{Game: rules.GameThunderball, MainMatches: 5, BonusMatches: 0, Tier: "Second"},
|
||||
{Game: rules.GameThunderball, MainMatches: 5, BonusMatches: 1, Tier: "Jackpot"},
|
||||
}
|
||||
|
||||
func GetThunderballPrizeIndex(main, bonus int) (int, bool) {
|
||||
switch {
|
||||
case main == 0 && bonus == 1:
|
||||
return 9, true
|
||||
case main == 1 && bonus == 1:
|
||||
return 8, true
|
||||
case main == 2 && bonus == 1:
|
||||
return 7, true
|
||||
case main == 3 && bonus == 0:
|
||||
return 6, true
|
||||
case main == 3 && bonus == 1:
|
||||
return 5, true
|
||||
case main == 4 && bonus == 0:
|
||||
return 4, true
|
||||
case main == 4 && bonus == 1:
|
||||
return 3, true
|
||||
case main == 5 && bonus == 0:
|
||||
return 2, true
|
||||
case main == 5 && bonus == 1:
|
||||
return 1, true
|
||||
default:
|
||||
return 0, false
|
||||
}
|
||||
}
|
||||
23
internal/rules/types.go
Normal file
23
internal/rules/types.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package rules
|
||||
|
||||
// PrizeRule defines how many matches correspond to which prize tier.
|
||||
type PrizeRule struct {
|
||||
Game string
|
||||
MainMatches int
|
||||
BonusMatches int
|
||||
Tier string
|
||||
}
|
||||
|
||||
// ToDo: should this struct not be in a model~?
|
||||
// PrizeInfo describes the tier and payout details.
|
||||
type PrizeInfo struct {
|
||||
Tier string
|
||||
Amount float64
|
||||
Label string
|
||||
}
|
||||
|
||||
// Game names (use constants to avoid typos). ToDo: should this not be in my constants folder or avoid constands folder as it may end up as a junk draw
|
||||
const (
|
||||
GameThunderball = "Thunderball"
|
||||
GameEuroJackpot = "EuroJackpot"
|
||||
)
|
||||
Reference in New Issue
Block a user