Skip to content

Commit

Permalink
fix method
Browse files Browse the repository at this point in the history
  • Loading branch information
boyter committed Aug 2, 2023
1 parent 3e49665 commit 4c49d9e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmd/badges/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func formatCount(count float64) string {

for _, v := range ranges {
if count >= v.val {
t := fmt.Sprintf("%.1f", math.Round(count/v.val))
t := fmt.Sprintf("%.1f", math.Ceil(count/v.val*10)/10)

if len(t) > 3 {
t = t[:strings.Index(t, ".")]
Expand Down
7 changes: 1 addition & 6 deletions cmd/badges/main_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package main

import (
"fmt"
"math"
"testing"
)

Expand Down Expand Up @@ -32,9 +30,6 @@ func Test_processPath(t *testing.T) {
}

func Test_formatCount(t *testing.T) {

fmt.Println(math.Round(2500 / 1000))

type args struct {
count float64
}
Expand Down Expand Up @@ -76,7 +71,7 @@ func Test_formatCount(t *testing.T) {
args: args{
count: 263804,
},
want: "264k",
want: "263k",
},
{
name: "",
Expand Down

0 comments on commit 4c49d9e

Please sign in to comment.