func getSeasonStats(c web.C, w http.ResponseWriter, r *http.Request) *appError { w.Header().Set("Content-Type", "application/json; charset=utf-8") season, _ := strconv.Atoi(c.URLParams["year"]) seasonStats := tournaments.SeasonStats([]int{season}) encoder := json.NewEncoder(w) encoder.Encode(seasonStats) return nil }
func getTotalStats(c web.C, w http.ResponseWriter, r *http.Request) *appError { w.Header().Set("Content-Type", "application/json; charset=utf-8") tList, err := tournaments.AllTournaments() if err != nil { return &appError{err, "Cant find tournaments", 404} } seasons := tList.Seasons() fullStats := tournaments.SeasonStats(seasons) encoder := json.NewEncoder(w) encoder.Encode(fullStats) return nil }