qa: Add multiple color on home page
Some checks reported errors
continuous-integration/drone/push Build was killed
Some checks reported errors
continuous-integration/drone/push Build was killed
This commit is contained in:
parent
4490eb7036
commit
95ca255d75
3 changed files with 38 additions and 4 deletions
|
|
@ -10,11 +10,38 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
router.GET("/api/qa_exercices.json", apiHandler(getExerciceTested))
|
||||
router.GET("/api/qa_mywork.json", apiHandler(getQAWork))
|
||||
router.GET("/api/qa_work.json", apiHandler(getQATodo))
|
||||
router.POST("/api/qa_work.json", apiHandler(createQATodo))
|
||||
}
|
||||
|
||||
type exerciceTested map[int64]string
|
||||
|
||||
func getExerciceTested(u QAUser, ps httprouter.Params, body []byte) (interface{}, error) {
|
||||
if team, err := fic.GetTeam(u.TeamId); err != nil {
|
||||
return nil, err
|
||||
} else if exercices, err := fic.GetExercices(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
ret := exerciceTested{}
|
||||
|
||||
for _, exercice := range exercices {
|
||||
if team.HasAccess(exercice) {
|
||||
if ok, _ := team.HasSolved(exercice); ok {
|
||||
ret[exercice.Id] = "solved"
|
||||
} else if cnt, _ := team.CountTries(exercice); cnt > 0 {
|
||||
ret[exercice.Id] = "tried"
|
||||
} else {
|
||||
ret[exercice.Id] = "access"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
}
|
||||
|
||||
func getQAWork(u QAUser, ps httprouter.Params, body []byte) (interface{}, error) {
|
||||
if team, err := fic.GetTeam(u.TeamId); err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
Reference in a new issue