package seasonsview import "git.haelnorr.com/h/oslstats/internal/db" import "git.haelnorr.com/h/oslstats/internal/view/baseview" import "encoding/json" import "fmt" type FixtureJSON struct { ID int `json:"id"` HomeTeam string `json:"homeTeam"` AwayTeam string `json:"awayTeam"` Round int `json:"round"` GameWeek *int `json:"gameWeek"` } func fixtureToJSON(f *db.Fixture) FixtureJSON { return FixtureJSON{ ID: f.ID, HomeTeam: f.HomeTeam.Name, AwayTeam: f.AwayTeam.Name, Round: f.Round, GameWeek: f.GameWeek, } } func fixturesToJSON(fixtures []*db.Fixture) string { data := make([]FixtureJSON, len(fixtures)) for i, f := range fixtures { data[i] = fixtureToJSON(f) } b, _ := json.Marshal(data) return string(b) } templ SeasonLeagueManageFixturesPage(season *db.Season, league *db.League, fixtures []*db.Fixture) { @baseview.Layout(fmt.Sprintf("%s - %s - Manage Fixtures", season.Name, league.Name)) {