challenge-sync-airbus: Use a score with better precision

This commit is contained in:
nemunaire 2024-03-19 13:59:28 +01:00
parent f157d9c3bd
commit c0017d7cbb
2 changed files with 3 additions and 1 deletions

View file

@ -102,6 +102,7 @@ type MyTeam struct {
Id int64 `json:"team_id"`
Name string `json:"name"`
Points int64 `json:"score"`
Points100 int64 `json:"score100"`
Members []*Member `json:"members,omitempty"`
Exercices map[string]myTeamExercice `json:"exercices"`
}
@ -123,6 +124,7 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
ret.Id = t.Id
points, _ := t.GetPoints()
ret.Points = int64(float64(points) * GlobalScoreCoefficient)
ret.Points100 = int64(float64(points) * GlobalScoreCoefficient * 100)
if members, err := t.GetMembers(); err == nil {
ret.Members = members
}

View file

@ -201,7 +201,7 @@ func (w *Walker) BalanceScores() error {
airbusTeam := w.TeamBindings[fmt.Sprintf("%d", myteam.Id)]
expected_score := int64(math.Floor(float64(myteam.Points) * w.Coeff))
expected_score := int64(math.Floor(float64(myteam.Points100) * w.Coeff / 100))
if airbusTeam == nil {
log.Printf("Skip team %q (tid=%d): no binding found", myteam.Name, myteam.Id)
} else if airbusTeam.Score != expected_score {