libfic: Update ScoreGridFormat format and expose stats

This commit is contained in:
nemunaire 2022-06-07 16:05:41 +02:00
commit 6d9fd1ff12
2 changed files with 32 additions and 16 deletions

View file

@ -2,8 +2,10 @@ package fic
import (
"encoding/hex"
"encoding/json"
"fmt"
"log"
"os"
"path"
"sort"
"strconv"
@ -81,7 +83,7 @@ type myTeamExercice struct {
Issue string `json:"issue,omitempty"`
IssueKind string `json:"issuekind,omitempty"`
}
type myTeam struct {
type MyTeam struct {
Id int64 `json:"team_id"`
Name string `json:"name"`
Points int64 `json:"score"`
@ -96,7 +98,7 @@ func (a ByOrder) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a ByOrder) Less(i, j int) bool { return a[i].order < a[j].order }
func MyJSONTeam(t *Team, started bool) (interface{}, error) {
ret := myTeam{}
ret := MyTeam{}
// Fill information about the team
if t == nil {
@ -401,3 +403,10 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
return ret, nil
}
func ReadMyJSON(fd *os.File) (my MyTeam, err error) {
jdec := json.NewDecoder(fd)
err = jdec.Decode(&my)
return
}