sync: import files in markdown, relative to theme/exercice dir

This commit is contained in:
nemunaire 2018-12-02 16:24:33 +01:00
commit 87471acf98
6 changed files with 75 additions and 8 deletions

View file

@ -6,6 +6,7 @@ import (
"log"
"time"
"path"
"strings"
)
type myTeamFile struct {
@ -96,7 +97,7 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
exercice.ThemeId = tid
}
exercice.Statement = e.Statement
exercice.Statement = strings.Replace(e.Statement, "$FILES$", FilesDir, -1)
if len(e.Issue) > 0 {
exercice.Issue = e.Issue
@ -104,7 +105,7 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
}
if t == nil {
exercice.Overview = e.Overview
exercice.Overview = strings.Replace(e.Overview, "$FILES$", FilesDir, -1)
exercice.VideoURI = e.VideoURI
exercice.Tries = e.TriedCount()
exercice.Gain = int(float64(e.Gain) * e.Coefficient)

View file

@ -3,6 +3,7 @@ package fic
import (
"fmt"
"path"
"strings"
)
// exportedExercice is a structure representing a challenge, as exposed to players.
@ -63,7 +64,7 @@ func ExportThemes() (interface{}, error) {
theme.URLId,
theme.Authors,
theme.Headline,
theme.Intro,
strings.Replace(theme.Intro, "$FILES$", FilesDir, -1),
imgpath,
exos,
}