madness continues
This commit is contained in:
@@ -7,6 +7,7 @@ func BuildBallsSlice(t models.Ticket) []int {
|
||||
if t.GameType == "Lotto" && t.Ball6 > 0 {
|
||||
balls = append(balls, t.Ball6)
|
||||
}
|
||||
|
||||
return balls
|
||||
}
|
||||
|
||||
@@ -18,5 +19,6 @@ func BuildBonusSlice(t models.Ticket) []int {
|
||||
if t.Bonus2 != nil {
|
||||
bonuses = append(bonuses, *t.Bonus2)
|
||||
}
|
||||
|
||||
return bonuses
|
||||
}
|
||||
|
||||
16
helpers/match.go
Normal file
16
helpers/match.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package helpers
|
||||
|
||||
func CountMatches(a, b []int) int {
|
||||
m := make(map[int]bool)
|
||||
for _, n := range b {
|
||||
m[n] = true
|
||||
}
|
||||
match := 0
|
||||
for _, n := range a {
|
||||
if m[n] {
|
||||
match++
|
||||
}
|
||||
}
|
||||
|
||||
return match
|
||||
}
|
||||
@@ -69,5 +69,6 @@ func InSlice(n int, list []int) bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user