remote-challenge-sync-airbus: WIP
This commit is contained in:
parent
6d9fd1ff12
commit
367e686e8a
5 changed files with 270 additions and 51 deletions
39
remote/challenge-sync-airbus/bindings.go
Normal file
39
remote/challenge-sync-airbus/bindings.go
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"srs.epita.fr/fic-server/libfic"
|
||||
)
|
||||
|
||||
type AirbusExercicesBindings map[int64]AirbusChallengeId
|
||||
|
||||
func ReadExercicesBindings(ebpath string) (AirbusExercicesBindings, error) {
|
||||
fd, err := os.Open(ebpath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer fd.Close()
|
||||
|
||||
jdec := json.NewDecoder(fd)
|
||||
|
||||
var aeb AirbusExercicesBindings
|
||||
err = jdec.Decode(&aeb)
|
||||
|
||||
return aeb, err
|
||||
}
|
||||
|
||||
func getTeams(pathname string) (teams map[string]fic.ExportedTeam, err error) {
|
||||
var cnt_raw []byte
|
||||
if cnt_raw, err = ioutil.ReadFile(pathname); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = json.Unmarshal(cnt_raw, &teams); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
Reference in a new issue