frontend: when a justification is valid, check the MCQ box

This commit is contained in:
nemunaire 2018-11-28 07:09:05 +01:00
parent ad6fe0394f
commit 69a866bbbf
2 changed files with 14 additions and 1 deletions

View File

@ -259,7 +259,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
value: mcq["checks_solved"] !== undefined && mcq["checks_solved"][cid] !== undefined && mcq["checks_solved"][cid] > 0 value: mcq["checks_solved"] !== undefined && mcq["checks_solved"][cid] !== undefined && mcq["checks_solved"][cid] > 0
}; };
if (mcq["checks_solved"] !== undefined) { if (mcq["checks_solved"] !== undefined) {
this[cid].disabled = true; this[cid].disabled = mcq["checks_solved"][cid] === undefined || mcq["checks_solved"][cid] >= 0;
this[cid].solved = mcq["checks_solved"][cid] !== undefined && mcq["checks_solved"][cid] >= 2; this[cid].solved = mcq["checks_solved"][cid] !== undefined && mcq["checks_solved"][cid] >= 2;
} }
}, mcq["choices"]); }, mcq["choices"]);

View File

@ -261,6 +261,19 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
} }
} }
} }
} else if PartialValidation {
m.PSolved = map[int64]int{}
for _, e := range mcq.Entries {
if _, ok := justifiedMCQ[m.Title + "%" + e.Label]; ok {
if _, ok := justifiedMCQ_ids[m.Title + "%" + e.Label]; !ok {
m.PSolved[e.Id] = 2
} else {
m.PSolved[e.Id] = -1
}
} else {
m.PSolved[e.Id] = -1
}
}
} }
} else { } else {
h := getHashedFlag([]byte(soluce)) h := getHashedFlag([]byte(soluce))