fic: Add Order, Help and Type values in struct

This commit is contained in:
nemunaire 2021-08-30 18:33:14 +02:00
parent 867e9bb345
commit 74e8c3801a
16 changed files with 134 additions and 110 deletions

View file

@ -115,7 +115,7 @@ func teamAssocHandler(f func(fic.Team, string, []byte) (interface{}, error)) fun
return func(ps httprouter.Params, body []byte) (interface{}, error) {
var team fic.Team
teamHandler(func (tm fic.Team, _ []byte) (interface{}, error) {
teamHandler(func(tm fic.Team, _ []byte) (interface{}, error) {
team = tm
return nil, nil
})(ps, body)
@ -193,7 +193,7 @@ func flagKeyHandler(f func(fic.FlagKey, fic.Exercice, []byte) (interface{}, erro
return nil, err
} else {
for _, flag := range flags {
if flag.Id == kid {
if flag.Id == int(kid) {
return f(flag, exercice, body)
}
}
@ -212,9 +212,9 @@ func choiceHandler(f func(fic.FlagChoice, fic.Exercice, []byte) (interface{}, er
return nil, nil
})(ps, body)
if cid, err := strconv.ParseInt(string(ps.ByName("cid")), 10, 64); err != nil {
if cid, err := strconv.ParseInt(string(ps.ByName("cid")), 10, 32); err != nil {
return nil, err
} else if choice, err := flag.GetChoice(cid); err != nil {
} else if choice, err := flag.GetChoice(int(cid)); err != nil {
return nil, err
} else {
return f(choice, exercice, body)
@ -236,7 +236,7 @@ func quizHandler(f func(fic.MCQ, fic.Exercice, []byte) (interface{}, error)) fun
return nil, err
} else {
for _, mcq := range mcqs {
if mcq.Id == int64(qid) {
if mcq.Id == int(qid) {
return f(mcq, exercice, body)
}
}
@ -316,13 +316,13 @@ func fileHandler(f func(fic.EFile, []byte) (interface{}, error)) func(httprouter
}
}
func fileDependancyHandler(f func(fic.EFile, int64, []byte) (interface{}, error)) func(httprouter.Params, []byte) (interface{}, error) {
func fileDependancyHandler(f func(fic.EFile, int, []byte) (interface{}, error)) func(httprouter.Params, []byte) (interface{}, error) {
return func(ps httprouter.Params, body []byte) (interface{}, error) {
if depid, err := strconv.ParseInt(string(ps.ByName("depid")), 10, 64); err != nil {
return nil, err
} else {
return fileHandler(func(file fic.EFile, b []byte) (interface{}, error) {
return f(file, depid, b)
return f(file, int(depid), b)
})(ps, body)
}
}