challenge-sync-airbus: Add an option to not search for exercice validation
This commit is contained in:
parent
bd9d9e9402
commit
1bd30632d3
@ -24,6 +24,7 @@ func main() {
|
|||||||
flag.StringVar(&TeamsDir, "teams", "./TEAMS", "Base directory where save teams JSON files")
|
flag.StringVar(&TeamsDir, "teams", "./TEAMS", "Base directory where save teams JSON files")
|
||||||
var debugINotify = flag.Bool("debuginotify", false, "Show skipped inotofy events")
|
var debugINotify = flag.Bool("debuginotify", false, "Show skipped inotofy events")
|
||||||
flag.BoolVar(&skipInitialSync, "skipinitialsync", skipInitialSync, "Skip the initial synchronization")
|
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")
|
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")
|
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")
|
exercicespath := flag.String("exercices-file", "./REMOTE/exercices-bindings.json", "Path to the file containing the ID bindings")
|
||||||
|
@ -10,6 +10,10 @@ import (
|
|||||||
"srs.epita.fr/fic-server/libfic"
|
"srs.epita.fr/fic-server/libfic"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
noValidateChallenge bool
|
||||||
|
)
|
||||||
|
|
||||||
type Walker struct {
|
type Walker struct {
|
||||||
LastSync map[AirbusUserId]time.Time
|
LastSync map[AirbusUserId]time.Time
|
||||||
Exercices AirbusExercicesBindings
|
Exercices AirbusExercicesBindings
|
||||||
@ -87,7 +91,7 @@ func (w *Walker) TreatScoreGrid(path string, airbusTeamId AirbusUserId) error {
|
|||||||
maxts = row.Time
|
maxts = row.Time
|
||||||
}
|
}
|
||||||
if row.Time.After(w.LastSync[airbusTeamId]) {
|
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])
|
err = w.API.ValidateChallengeFromUser(airbusTeamId, w.Exercices[row.IdExercice])
|
||||||
} else {
|
} else {
|
||||||
err = w.API.AwardUser(airbusTeamId, int64(row.Points*row.Coeff*w.Coeff), row.Reason)
|
err = w.API.AwardUser(airbusTeamId, int64(row.Points*row.Coeff*w.Coeff), row.Reason)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user