Skip to content

Commit

Permalink
fix submsissions table
Browse files Browse the repository at this point in the history
table was not displaying scores. Honestly not sure what kind of BS I was concocting there for it not to render properly...
  • Loading branch information
p5quared committed Feb 26, 2024
1 parent 67a2fa1 commit 9480fd0
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"net/http"
"sort"
"strconv"
"time"

"github.com/speedata/optionparser"
Expand Down Expand Up @@ -258,18 +257,15 @@ func displaySubmission(submission Autolab.SubmissionsResponse) {
}
})
scores := submission.Scores
var keys []int
keys := make([]string, 0, len(scores))
for k := range scores {
n, _ := strconv.Atoi(k)
keys = append(keys, n)
keys = append(keys, k)
}

sort.Ints(keys)
sort.Strings(keys)

for _, prob := range keys {
score := scores[strconv.Itoa(prob)]
prob_str := strconv.Itoa(prob)
t.Row(prob_str, strconv.FormatFloat(score, 'f', -1, 32))
for _, k := range keys {
t.Row(k, fmt.Sprintf("%.2f", scores[k]))
}
fmt.Println(t.Render())
}
Expand Down

0 comments on commit 9480fd0

Please sign in to comment.