Change exported flags format in my.json

This commit is contained in:
nemunaire 2018-11-28 02:27:51 +01:00
commit 195490484c
5 changed files with 44 additions and 55 deletions

View file

@ -264,7 +264,7 @@ func (e Exercice) TriedCount() int64 {
// CheckResponse, given both flags and MCQ responses, figures out if thoses are correct (or if they are previously solved).
// In the meanwhile, CheckResponse registers good answers given (but it does not mark the challenge as solved at the end).
func (e Exercice) CheckResponse(cksum []byte, respflags map[string]string, respmcq map[int64]bool, t Team) (bool, error) {
func (e Exercice) CheckResponse(cksum []byte, respflags map[int64]string, respmcq map[int64]bool, t Team) (bool, error) {
if err := e.NewTry(t, cksum); err != nil {
return false, err
} else if flags, err := e.GetFlags(); err != nil {
@ -298,7 +298,7 @@ func (e Exercice) CheckResponse(cksum []byte, respflags map[string]string, respm
// Check flags
for _, flag := range flags {
if res, ok := respflags[flag.Label]; !ok {
if res, ok := respflags[flag.Id]; !ok {
valid = false
} else if !flag.Check([]byte(res)) {
if !PartialValidation || t.HasPartiallySolved(flag) == nil {