Utilise a new field to send justifications instead of too complex guessing crap
This commit is contained in:
parent
69a866bbbf
commit
d40922629b
6 changed files with 69 additions and 24 deletions
|
|
@ -23,7 +23,7 @@ type myTeamHint struct {
|
|||
}
|
||||
type myTeamMCQ struct {
|
||||
Title string `json:"title"`
|
||||
Justify []int64 `json:"justify,omitempty"`
|
||||
Justify bool `json:"justify,omitempty"`
|
||||
Choices map[int64]string `json:"choices,omitempty"`
|
||||
Solved *time.Time `json:"solved,omitempty"`
|
||||
PSolved map[int64]int `json:"checks_solved,omitempty"`
|
||||
|
|
@ -211,8 +211,6 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
|
|||
|
||||
soluce := ""
|
||||
solved_justify := true
|
||||
var nb_gen_justify_id int64
|
||||
var max_justify_id int64
|
||||
|
||||
for _, e := range mcq.Entries {
|
||||
m.Choices[e.Id] = e.Label
|
||||
|
|
@ -222,31 +220,18 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
|
|||
soluce += "f"
|
||||
}
|
||||
if v, ok := justifiedMCQ[m.Title + "%" + e.Label]; ok {
|
||||
if m.Justify == nil {
|
||||
m.Justify = []int64{}
|
||||
}
|
||||
m.Justify = true
|
||||
|
||||
if t == nil {
|
||||
soluce += hex.EncodeToString(v)
|
||||
}
|
||||
|
||||
if v, ok := justifiedMCQ_ids[m.Title + "%" + e.Label]; ok {
|
||||
if _, ok := justifiedMCQ_ids[m.Title + "%" + e.Label]; ok {
|
||||
solved_justify = false
|
||||
m.Justify = append(m.Justify, v)
|
||||
if v > max_justify_id {
|
||||
max_justify_id = v
|
||||
}
|
||||
}
|
||||
} else {
|
||||
nb_gen_justify_id += 1
|
||||
}
|
||||
}
|
||||
|
||||
// Fill the rest of the array with factice values in order to hide number of valid choices
|
||||
for i := int64(0); i < nb_gen_justify_id; i++ {
|
||||
m.Justify = append(m.Justify, max_justify_id + 1 + i)
|
||||
}
|
||||
|
||||
if t != nil {
|
||||
if solved_justify {
|
||||
m.Solved = t.HasPartiallyRespond(mcq)
|
||||
|
|
|
|||
Reference in a new issue