From 1bd30632d3354472b8a8473cc0b1c6b6b638df8e Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Mon, 3 Apr 2023 12:04:48 +0200 Subject: [PATCH] challenge-sync-airbus: Add an option to not search for exercice validation --- remote/challenge-sync-airbus/main.go | 1 + remote/challenge-sync-airbus/treat.go | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/remote/challenge-sync-airbus/main.go b/remote/challenge-sync-airbus/main.go index 82948061..fc5dc53d 100644 --- a/remote/challenge-sync-airbus/main.go +++ b/remote/challenge-sync-airbus/main.go @@ -24,6 +24,7 @@ func main() { flag.StringVar(&TeamsDir, "teams", "./TEAMS", "Base directory where save teams JSON files") var debugINotify = flag.Bool("debuginotify", false, "Show skipped inotofy events") flag.BoolVar(&skipInitialSync, "skipinitialsync", skipInitialSync, "Skip the initial synchronization") + flag.BoolVar(&noValidateChallenge, "no-validate-challenge", noValidateChallenge, "Consider challenge validation as a standard award (if each exercice hasn't been imported on their side)") daemon := flag.Bool("watch", false, "Enable daemon mode by watching the directory") tspath := flag.String("timestamp-file", "./REMOTE/timestamp", "Path to the file storing the last timestamp") exercicespath := flag.String("exercices-file", "./REMOTE/exercices-bindings.json", "Path to the file containing the ID bindings") diff --git a/remote/challenge-sync-airbus/treat.go b/remote/challenge-sync-airbus/treat.go index f248055c..d4b505a7 100644 --- a/remote/challenge-sync-airbus/treat.go +++ b/remote/challenge-sync-airbus/treat.go @@ -10,6 +10,10 @@ import ( "srs.epita.fr/fic-server/libfic" ) +var ( + noValidateChallenge bool +) + type Walker struct { LastSync map[AirbusUserId]time.Time Exercices AirbusExercicesBindings @@ -87,7 +91,7 @@ func (w *Walker) TreatScoreGrid(path string, airbusTeamId AirbusUserId) error { maxts = row.Time } if row.Time.After(w.LastSync[airbusTeamId]) { - if row.Reason == "Validation" { + if !noValidateChallenge && row.Reason == "Validation" { err = w.API.ValidateChallengeFromUser(airbusTeamId, w.Exercices[row.IdExercice]) } else { err = w.API.AwardUser(airbusTeamId, int64(row.Points*row.Coeff*w.Coeff), row.Reason)