challenge-sync-airbus: Handle individual try

This commit is contained in:
nemunaire 2024-03-19 13:58:37 +01:00
commit f157d9c3bd
3 changed files with 54 additions and 0 deletions

View file

@ -168,6 +168,10 @@ func (w *Walker) TreatScoreGrid(path string, airbusTeam *AirbusTeam) error {
if row.Time.After(ts.Time) {
if !noValidateChallenge && row.Reason == "Validation" {
err = w.API.ValidateChallengeFromUser(airbusTeam, w.Exercices[row.IdExercice])
} else if row.Reason == "Tries" {
// Just add 1 try at a time as the field is updated
row.Points = fic.TermTriesSeq(fic.ReverseTriesPoints(int64(row.Points)))
err = w.API.AwardUser(airbusTeam, int64(math.Trunc(row.Points*row.Coeff*w.Coeff)), row.Reason)
} else {
err = w.API.AwardUser(airbusTeam, int64(row.Points*row.Coeff*w.Coeff), row.Reason)
}