backend: rely on configuration instead of started file to determine if the challenge is launched or not
This commit is contained in:
parent
af1cecd3ce
commit
75463dcebb
|
@ -12,14 +12,6 @@ import (
|
|||
"srs.epita.fr/fic-server/libfic"
|
||||
)
|
||||
|
||||
// Check if the challenge is started or not
|
||||
func isStarted() bool {
|
||||
if _, err := os.Stat(path.Join(SubmissionDir, "started")); os.IsNotExist(err) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Generate my.json and wait.json for a given team
|
||||
func genTeamMyFile(team fic.Team) error {
|
||||
dirPath := path.Join(TeamsDir, fmt.Sprintf("%d", team.Id))
|
||||
|
@ -39,7 +31,7 @@ func genTeamMyFile(team fic.Team) error {
|
|||
}
|
||||
|
||||
// Speed up generation when challenge is started
|
||||
if !isStarted() {
|
||||
if !ChStarted {
|
||||
if my, err := fic.MyJSONTeam(&team, false); err != nil {
|
||||
return err
|
||||
} else if j, err := json.Marshal(my); err != nil {
|
||||
|
|
|
@ -43,6 +43,7 @@ func watchsubdir(watcher *fsnotify.Watcher, pathname string) error {
|
|||
}
|
||||
}
|
||||
|
||||
var ChStarted = false
|
||||
var lastRegeneration time.Time
|
||||
var skipInitialGeneration = false
|
||||
|
||||
|
@ -50,6 +51,7 @@ func reloadSettings(config settings.FICSettings) {
|
|||
fic.HintCoefficient = config.HintCurCoefficient
|
||||
fic.WChoiceCoefficient = config.WChoiceCurCoefficient
|
||||
fic.ExerciceCurrentCoefficient = config.ExerciceCurCoefficient
|
||||
ChStarted = time.Since(config.Start) >= 0
|
||||
if lastRegeneration != config.Generation || fic.PartialValidation != config.PartialValidation || fic.FirstBlood != config.FirstBlood || fic.SubmissionCostBase != config.SubmissionCostBase || fic.SubmissionUniqueness != config.SubmissionUniqueness {
|
||||
fic.PartialValidation = config.PartialValidation
|
||||
if config.EnableExerciceDepend {
|
||||
|
|
Loading…
Reference in New Issue
Block a user