fixed bug in sorting
This commit is contained in:
parent
ca399c05b7
commit
0da80226c0
2
main.go
2
main.go
@ -39,7 +39,7 @@ func (bv ByVotes) Swap(i, j int) {
|
|||||||
bv[i], bv[j] = bv[j], bv[i]
|
bv[i], bv[j] = bv[j], bv[i]
|
||||||
}
|
}
|
||||||
func (bv ByVotes) Less(i, j int) bool {
|
func (bv ByVotes) Less(i, j int) bool {
|
||||||
return math.Abs(float64(bv[i].Up-bv[i].Down)) > math.Abs(float64(bv[j].Up-bv[j].Down))
|
return float64(bv[i].Up-bv[i].Down) > float64(bv[j].Up-bv[j].Down)
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
Loading…
Reference in New Issue
Block a user