repochecker: Ensure hint and choice_cost are not higher than gain
This commit is contained in:
parent
09c1111135
commit
7fbe2f3f8e
2 changed files with 20 additions and 6 deletions
|
|
@ -123,7 +123,15 @@ func buildExerciceHints(i Importer, exercice *fic.Exercice, exceptions *CheckExc
|
|||
func CheckExerciceHints(i Importer, exercice *fic.Exercice, exceptions *CheckExceptions) ([]importHint, error) {
|
||||
exceptions = exceptions.GetFileExceptions("challenge.txt", "challenge.toml")
|
||||
|
||||
return buildExerciceHints(i, exercice, exceptions)
|
||||
hints, errs := buildExerciceHints(i, exercice, exceptions)
|
||||
|
||||
for _, hint := range hints {
|
||||
if hint.Hint.Cost >= exercice.Gain {
|
||||
errs = multierr.Append(errs, NewHintError(exercice, hint.Hint, hint.Line, fmt.Errorf("hint's cost is higher than exercice gain")))
|
||||
}
|
||||
}
|
||||
|
||||
return hints, errs
|
||||
}
|
||||
|
||||
// SyncExerciceHints reads the content of files/ directories and import it as EHint for the given challenge.
|
||||
|
|
|
|||
Reference in a new issue