This commit is contained in:
2026-07-21 05:29:37 +03:00
commit edb875f197
299 changed files with 140638 additions and 0 deletions

41
daemon/helpers.go Normal file
View 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
}