Write docs!
This commit is contained in:
parent
c460bb7bf5
commit
bcc598ebd5
37 changed files with 478 additions and 188 deletions
|
|
@ -4,7 +4,8 @@ import (
|
|||
"fmt"
|
||||
)
|
||||
|
||||
type ExportedExercice struct {
|
||||
// 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"`
|
||||
|
|
@ -13,14 +14,16 @@ type ExportedExercice struct {
|
|||
Tried int64 `json:"tried"`
|
||||
}
|
||||
|
||||
// exportedTheme is a structure representing a Theme, as exposed to players.
|
||||
type exportedTheme struct {
|
||||
Name string `json:"name"`
|
||||
URLId string `json:"urlid"`
|
||||
Authors string `json:"authors"`
|
||||
Intro string `json:"intro"`
|
||||
Exercices map[string]ExportedExercice `json:"exercices"`
|
||||
Exercices map[string]exportedExercice `json:"exercices"`
|
||||
}
|
||||
|
||||
// Exportedthemes exports themes from the database, to be displayed to players.
|
||||
func ExportThemes() (interface{}, error) {
|
||||
if themes, err := GetThemes(); err != nil {
|
||||
return nil, err
|
||||
|
|
@ -30,9 +33,9 @@ func ExportThemes() (interface{}, error) {
|
|||
if exercices, err := theme.GetExercices(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
exos := map[string]ExportedExercice{}
|
||||
exos := map[string]exportedExercice{}
|
||||
for _, exercice := range exercices {
|
||||
exos[fmt.Sprintf("%d", exercice.Id)] = ExportedExercice{
|
||||
exos[fmt.Sprintf("%d", exercice.Id)] = exportedExercice{
|
||||
exercice.Title,
|
||||
exercice.URLId,
|
||||
exercice.Gain,
|
||||
|
|
|
|||
Reference in a new issue