ui: Handle exercice image

This commit is contained in:
nemunaire 2023-06-14 20:51:48 +02:00
commit 1a8ebcb8bf
2 changed files with 20 additions and 1 deletions

View file

@ -13,6 +13,7 @@ type exportedExercice struct {
Id int64 `json:"id"`
Title string `json:"title"`
Headline string `json:"headline,omitempty"`
Image string `json:"image,omitempty"`
URLId string `json:"urlid"`
Tags []string `json:"tags"`
Gain int64 `json:"gain"`
@ -53,11 +54,17 @@ func ExportThemes() (interface{}, error) {
continue
}
exoimgpath := ""
if len(exercice.Image) > 0 {
exoimgpath = path.Join(FilesDir, exercice.Image)
}
tags, _ := exercice.GetTags()
exos = append(exos, exportedExercice{
exercice.Id,
exercice.Title,
exercice.Headline,
exoimgpath,
exercice.URLId,
tags,
int64(float64(exercice.Gain) * GlobalScoreCoefficient),