admin: Add exercice's tags: sync, api, interface done

This commit is contained in:
nemunaire 2018-11-18 22:44:23 +01:00 committed by Pierre-Olivier Mercier
parent 665fd301c6
commit f183985982
10 changed files with 166 additions and 20 deletions

View file

@ -6,12 +6,13 @@ import (
// exportedExercice is a structure representing a challenge, as exposed to players.
type exportedExercice struct {
Title string `json:"title"`
URLId string `json:"urlid"`
Gain int64 `json:"gain"`
Coeff float64 `json:"curcoeff"`
Solved int64 `json:"solved"`
Tried int64 `json:"tried"`
Title string `json:"title"`
URLId string `json:"urlid"`
Tags []string `json:"tags"`
Gain int64 `json:"gain"`
Coeff float64 `json:"curcoeff"`
Solved int64 `json:"solved"`
Tried int64 `json:"tried"`
}
// exportedTheme is a structure representing a Theme, as exposed to players.
@ -35,9 +36,11 @@ func ExportThemes() (interface{}, error) {
} else {
exos := map[string]exportedExercice{}
for _, exercice := range exercices {
tags, _ := exercice.GetTags()
exos[fmt.Sprintf("%d", exercice.Id)] = exportedExercice{
exercice.Title,
exercice.URLId,
tags,
exercice.Gain,
exercice.Coefficient,
exercice.SolvedCount(),