checker: Ensure a flag is found before considering a good response

This commit is contained in:
nemunaire 2024-03-27 21:30:20 +01:00
parent c53140b88e
commit 76606b3c80

View File

@ -594,10 +594,13 @@ func (e *Exercice) CheckResponse(cksum []byte, respflags map[int]string, respmcq
valid = valid && flag.IsOptionnal() valid = valid && flag.IsOptionnal()
} }
} else { } else {
flag.FoundBy(t) err := flag.FoundBy(t)
if err == nil {
// err is unicity issue, probably flag already found
goodResponses += 1 goodResponses += 1
} }
} }
}
if diff > 0 || goodResponses > 0 { if diff > 0 || goodResponses > 0 {
e.UpdateTry(t, diff, goodResponses > 0) e.UpdateTry(t, diff, goodResponses > 0)