challenge-sync-airbus: Use a score with better precision
This commit is contained in:
parent
f157d9c3bd
commit
c0017d7cbb
2 changed files with 3 additions and 1 deletions
|
@ -102,6 +102,7 @@ type MyTeam struct {
|
||||||
Id int64 `json:"team_id"`
|
Id int64 `json:"team_id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Points int64 `json:"score"`
|
Points int64 `json:"score"`
|
||||||
|
Points100 int64 `json:"score100"`
|
||||||
Members []*Member `json:"members,omitempty"`
|
Members []*Member `json:"members,omitempty"`
|
||||||
Exercices map[string]myTeamExercice `json:"exercices"`
|
Exercices map[string]myTeamExercice `json:"exercices"`
|
||||||
}
|
}
|
||||||
|
@ -123,6 +124,7 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
|
||||||
ret.Id = t.Id
|
ret.Id = t.Id
|
||||||
points, _ := t.GetPoints()
|
points, _ := t.GetPoints()
|
||||||
ret.Points = int64(float64(points) * GlobalScoreCoefficient)
|
ret.Points = int64(float64(points) * GlobalScoreCoefficient)
|
||||||
|
ret.Points100 = int64(float64(points) * GlobalScoreCoefficient * 100)
|
||||||
if members, err := t.GetMembers(); err == nil {
|
if members, err := t.GetMembers(); err == nil {
|
||||||
ret.Members = members
|
ret.Members = members
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,7 +201,7 @@ func (w *Walker) BalanceScores() error {
|
||||||
|
|
||||||
airbusTeam := w.TeamBindings[fmt.Sprintf("%d", myteam.Id)]
|
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 {
|
if airbusTeam == nil {
|
||||||
log.Printf("Skip team %q (tid=%d): no binding found", myteam.Name, myteam.Id)
|
log.Printf("Skip team %q (tid=%d): no binding found", myteam.Name, myteam.Id)
|
||||||
} else if airbusTeam.Score != expected_score {
|
} else if airbusTeam.Score != expected_score {
|
||||||
|
|
Reference in a new issue