1st
This commit is contained in:
41
daemon/helpers.go
Normal file
41
daemon/helpers.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package daemon
|
||||
|
||||
import (
|
||||
"math"
|
||||
"sort"
|
||||
|
||||
"gordenko.dev/dima/onexbet"
|
||||
)
|
||||
|
||||
func isFloatEqual(a, b, eps float64) bool {
|
||||
if math.Abs(a-b) < eps {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func SortOffersByParamMaxMin(offers []onexbet.ParamOffer) {
|
||||
sort.Slice(offers, func(i, j int) bool {
|
||||
if offers[i].ParamFloat > offers[j].ParamFloat {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
})
|
||||
}
|
||||
|
||||
func SortOffersByParamMinMax(offers []onexbet.ParamOffer) {
|
||||
sort.Slice(offers, func(i, j int) bool {
|
||||
if offers[i].ParamFloat < offers[j].ParamFloat {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
})
|
||||
}
|
||||
|
||||
func isTennisSetCompleted(score onexbet.PeriodScore) (_ bool) {
|
||||
if (score.HomePoints == 6 && score.AwayPoints < 5) || score.HomePoints == 7 ||
|
||||
(score.AwayPoints == 6 && score.HomePoints < 5) || score.AwayPoints == 7 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user