Files
tipper/daemon/helpers.go

42 lines
820 B
Go
Raw Normal View History

2026-07-21 05:29:37 +03:00
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
}