remote-challenge-sync-airbus: WIP
This commit is contained in:
parent
a82defe2a7
commit
0831ea6088
3 changed files with 65 additions and 22 deletions
|
|
@ -38,11 +38,11 @@ func (w *Walker) treat(path string) {
|
|||
airbusTeamId := NewAirbusUserId(w.Teams[fmt.Sprintf("%d", teammy.Id)].ExternalId)
|
||||
|
||||
// Treat score grid
|
||||
err = w.TreatScoreGrid(path, airbusTeamId)
|
||||
/*err = w.TreatScoreGrid(path, airbusTeamId)
|
||||
if err != nil {
|
||||
log.Println("Unable to treat score grid:", err)
|
||||
return
|
||||
}
|
||||
}*/
|
||||
|
||||
// Balance scores
|
||||
err = w.BalanceScore(int64(float64(teammy.Points)*w.Coeff), airbusTeamId)
|
||||
|
|
@ -53,6 +53,13 @@ func (w *Walker) treat(path string) {
|
|||
}
|
||||
}
|
||||
|
||||
func (w *Walker) WalkScoreSync(path string, d os.DirEntry, err error) error {
|
||||
if filepath.Base(path) == "scores.json" {
|
||||
w.treat(path)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (w *Walker) WalkScore(path string, d os.DirEntry, err error) error {
|
||||
if filepath.Base(path) == "scores.json" {
|
||||
go w.treat(path)
|
||||
|
|
@ -104,7 +111,7 @@ func (w *Walker) BalanceScore(score int64, airbusTeamId AirbusUserId) error {
|
|||
fmt.Errorf("unable to retrieve current stats: %w", err)
|
||||
}
|
||||
|
||||
my_session := stats.Data.GetSession(AirbusUUID(w.API.SessionID))
|
||||
my_session := stats.Data.GetSession(AirbusUUID(w.API.SessionUUID))
|
||||
if my_session == nil {
|
||||
return fmt.Errorf("session not found")
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue