Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion constants/constants.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package constants

const (
FinalPortalRound uint = 5
FinalPortalRound uint = 11
MaxFBSRosterSize int = 105
MaxFCSRosterSize int = 85
PortalSigningMinimum float64 = 0.66
Expand Down
4 changes: 4 additions & 0 deletions controller/FixesController.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ func FixNFLStadiums(w http.ResponseWriter, r *http.Request) {
func FixPlayerWeights(w http.ResponseWriter, r *http.Request) {
managers.FixPlayerWeights()
}

func FixTimeslots(w http.ResponseWriter, r *http.Request) {
managers.FixTimeslots()
}
26 changes: 19 additions & 7 deletions controller/GameDataController.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ func GetHomeAndAwayTeamData(w http.ResponseWriter, r *http.Request) {
homeRosterChan := make(chan []structs.CollegePlayer)
awayRosterChan := make(chan []structs.CollegePlayer)
stadiumChan := make(chan structs.Stadium)

homeTeamID := strconv.Itoa(int(game.HomeTeamID))
awayTeamID := strconv.Itoa(int(game.AwayTeamID))
stadiumID := strconv.Itoa(int(game.StadiumID))
go func() {
waitgroup.Wait()
close(homeTeamChan)
Expand All @@ -57,21 +59,21 @@ func GetHomeAndAwayTeamData(w http.ResponseWriter, r *http.Request) {

go func() {
defer waitgroup.Done()
ht := managers.GetTeamByTeamAbbr(game.HomeTeam)
ht := managers.GetTeamByTeamID(homeTeamID)
homeTeamChan <- ht
}()

go func() {
defer waitgroup.Done()
at := managers.GetTeamByTeamAbbr(game.AwayTeam)
at := managers.GetTeamByTeamID(awayTeamID)
awayTeamChan <- at
}()

homeTeam := <-homeTeamChan
awayTeam := <-awayTeamChan
homeTeamID := strconv.Itoa(int(homeTeam.ID))
awayTeamID := strconv.Itoa(int(awayTeam.ID))
stadiumID := strconv.Itoa(int(game.StadiumID))
if stadiumID == "0" {
stadiumID = strconv.Itoa(int(homeTeam.StadiumID))
}

go func() {
defer rosterGroup.Done()
Expand All @@ -87,7 +89,17 @@ func GetHomeAndAwayTeamData(w http.ResponseWriter, r *http.Request) {

go func() {
defer rosterGroup.Done()
st := managers.GetStadiumByStadiumID(stadiumID)
st := structs.Stadium{}
if stadiumID == "0" {
stadiumID = game.Stadium
stadiums := managers.GetAllStadiums()
stadiumMap := managers.MakeStadiumMapByID(stadiums)
if s, ok := stadiumMap[game.StadiumID]; ok {
st = s
}
} else {
st = managers.GetStadiumByStadiumID(stadiumID)
}
stadiumChan <- st
}()

Expand Down
5 changes: 5 additions & 0 deletions controller/SchedulerController.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,8 @@ func SwapCFBHomeAndAwayTeams(w http.ResponseWriter, r *http.Request) {
managers.SwapCFBGameHomeAndAwayTeams(gameID)
json.NewEncoder(w).Encode(true)
}

func GenerateOOCGames(w http.ResponseWriter, r *http.Request) {
managers.GenerateOOCSchedule()
json.NewEncoder(w).Encode(true)
}
321 changes: 321 additions & 0 deletions data/2027/2027_nfl_regularseason_games.csv

Large diffs are not rendered by default.

36 changes: 32 additions & 4 deletions data/2027/stadia.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
id,stadium_name,team_id,team_abbr,city,state,country,region,capacity,record_attendance,first_season,league_id,league_name,is_domed
292,National Football Stadium,267,UOG,Mangilao,GM,USA,Pacific,1000,0,2027,2,FCS,0
293,Veterans Memorial Stadium,268,SAMO,Pago Pago,AS,USA,Pacific,1000,0,2027,2,FCS,0
294,Darrell Gooden Stadium,269,UWF,Pensacola,FL,USA,Southeast,7500,0,2027,2,FCS,0
295,Marquette Stadium,270,MARQ,Milwaukee,WI,USA,Midwest,24000,0,2027,2,FCS,0
328,Rogers Centre,0,,Toronto,ON,Canada,Northeast,39150,0,2027,3,NFL,1
297,Estadio Azteca,0,,Coyoacan,MC,Mexico,Southwest,87523,0,2027,3,NFL,0
298,Wembley Stadium,0,,London,,UK,Europe,86000,0,2027,3,NFL,0
299,Tokyo Dome,0,,Bunkyo,TK,Japan,Northwest,57000,0,2027,3,NFL,1
300,Croke Park,0,,Dublin,,Ireland,Europe,90556,0,2027,3,NFL,0
301,BC Place,0,,Vancouver,BC,Canada,Northwest,54500,0,2027,3,NFL,1
302,Maracana Stadium,0,,Maracana,Rio,Brazil,South,73139,0,2027,3,NFL,0
303,Allianz Arena,0,,Munich,BV,Germany,Europe,75024,0,2027,3,NFL,0
304,Modi Stadium,0,,Ahmedabad,GJ,India,South,132000,0,2027,3,NFL,0
305,Melbourne Cricket Ground,0,,Melbourne,VC,Australia,South,100024,0,2027,3,NFL,0
306,Camp Nou,0,,Barcelona,,Spain,Europe,99354,0,2027,3,NFL,0
307,FNB Stadium,0,,Johannesburg,,South Africa,Africa,94736,0,2027,3,NFL,0
308,Bukit Jalil National Stadium,0,,Kuala Lumpur,,Malaysia,Oceania,87500,0,2027,3,NFL,0
309,Borg El Arab Stadium,0,,Alexandria,,Egypt,North Africa,86000,0,2027,3,NFL,0
310,Estadio Monumental,0,,Buenos Aires,,Argentina,South America,85018,0,2027,3,NFL,0
311,Bernabeu,0,,Madrid,,Spain,Europe,83186,0,2027,3,NFL,1
312,Signal Iduna Park,0,,Dortmund,,Germany,Europe,81365,0,2027,3,NFL,0
313,Stade de France,0,,Saint-Denis,,France,Europe,81338,0,2027,3,NFL,0
314,San Siro,0,,Milan,,Italy,Europe,80018,0,2027,3,NFL,0
315,Tangier Grand Stadium,0,,Tangier,,Morocco,North Africa,75500,0,2027,3,NFL,0
316,Beijing National Stadium,0,,Beijing,,China,North China,91000,0,2027,3,NFL,0
317,Old Trafford,0,,Manchester,,England,England,74244,0,2027,3,NFL,0
318,Olympic Stadium,0,,Athens,,Greece,Mediterranean,75000,0,2027,3,NFL,0
319,Stadio Olimpico,0,,Rome,,Italy,Mediterranean,70634,0,2027,3,NFL,0
320,Seoul Olympic Stadium,0,,Seoul,,South Korea,Asia Pacific,65599,0,2027,3,NFL,0
321,National Stadium,0,,Yuoying,Kaohsiung,Taiwan,Asia Pacific,55000,0,2027,3,NFL,0
322,National Stadium,0,,Singapore,Singapore,Singapore,Asia Pacific,55000,0,2027,3,NFL,0
323,ISS International,0,,Space,Space,Space,Space,7,0,2027,3,NFL,1
324,Nelson Road,0,,Richmond,London,England,England,34000,0,2027,3,NFL,0
325,Taipei Dome,0,,Xinyi,Taipei,Taiwan,Asia Pacific,40000,0,2027,3,NFL,1
326,Jeju World Cup Stadium,0,,Seogwipo,Jeju,South Korea,Asia Pacific,42000,0,2027,3,NFL,0
327,Centennial Ataturk Stadium,0,,Bursa,,Turkey,Mediterranean,43361,0,2027,3,NFL,0
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ func handleRequests() http.Handler {
// apiRouter.HandleFunc("/fix/profile/mods", controller.FixRecruitProfileMods).Methods("GET")
// apiRouter.HandleFunc("/fix/nfl/stadiums", controller.FixNFLStadiums).Methods("GET")
// apiRouter.HandleFunc("/fix/player/weights", controller.FixPlayerWeights).Methods("GET")
// apiRouter.HandleFunc("/fix/timeslots", controller.FixTimeslots).Methods("GET")

// Free Agency Controls
// apiRouter.HandleFunc("/nfl/extensions/sync", controller.SyncExtensions).Methods("GET")
Expand Down Expand Up @@ -207,6 +208,9 @@ func handleRequests() http.Handler {
apiRouter.HandleFunc("/cfb/schedule/game/request/reject/{requestID}", controller.RejectCFBGameRequest).Methods("GET")
apiRouter.HandleFunc("/cfb/schedule/game/request/process/{requestID}", controller.ProcessCFBGameRequest).Methods("GET")
apiRouter.HandleFunc("/cfb/schedule/game/request/veto/{requestID}", controller.VetoCFBGameRequest).Methods("GET")
apiRouter.HandleFunc("/cfb/schedule/game/request/swap/{gameID}", controller.SwapCFBHomeAndAwayTeams).Methods("GET")
// apiRouter.HandleFunc("/cfb/schedule/ooc/game/generation", controller.GenerateOOCGames).Methods("GET")

// Game Request Controls - NFL
apiRouter.HandleFunc("/nfl/schedule/game/request/create", controller.CreateNFLGameRequest).Methods("POST")
apiRouter.HandleFunc("/nfl/schedule/game/request/accept/{requestID}", controller.AcceptNFLGameRequest).Methods("GET")
Expand Down
3 changes: 2 additions & 1 deletion managers/ExportManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import (
)

func ExportAllRostersToCSV(w http.ResponseWriter) {
ts := GetTimestamp()
w.Header().Set("Content-Type", "text/csv; charset=utf-8")
w.Header().Set("Content-Disposition", "attachment;filename=2023_Rosters.csv")
w.Header().Set("Content-Disposition", "attachment;filename="+strconv.Itoa(int(ts.Season))+"_Rosters.csv")
w.Header().Set("Transfer-Encoding", "chunked")
// Initialize writer
writer := csv.NewWriter(w)
Expand Down
18 changes: 18 additions & 0 deletions managers/FixesManager.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package managers

import (
"strconv"

"github.com/CalebRose/SimFBA/dbprovider"
"github.com/CalebRose/SimFBA/repository"
"github.com/CalebRose/SimFBA/structs"
Expand Down Expand Up @@ -179,3 +181,19 @@ func FixPlayerWeights() {
repository.SaveNFLPlayerRecord(player, db)
}
}

func FixTimeslots() {
db := dbprovider.GetInstance().GetDB()
ts := GetTimestamp()
cfbTeamMap := GetCollegeTeamMap()

collegeGames := repository.FindCollegeGamesRecords(repository.GamesQuery{SeasonID: strconv.Itoa(int(ts.CollegeSeasonID))})

for _, game := range collegeGames {
if game.TimeSlot == "Thursday Night" && !game.IsNeutral && game.IsSpringGame {
homeTeam := cfbTeamMap[uint(game.HomeTeamID)]
game.TimeSlot = util.GetTimeslot(game.State, uint(homeTeam.ConferenceID))
repository.SaveCFBGameRecord(game, db)
}
}
}
2 changes: 1 addition & 1 deletion managers/GameManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func SwapCFBGameHomeAndAwayTeams(gameID string) {
repository.SaveCFBGameRecord(game, db)

// Generate Weather
GenerateWeatherForGames()
// GenerateWeatherForGames()
}

func GetCollegeGamesByWeekIdAndSeasonID(WeekID string, SeasonID string) []structs.CollegeGame {
Expand Down
3 changes: 3 additions & 0 deletions managers/GameplanManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -2069,6 +2069,9 @@ func DetermineAIGameplan() {
if t.Coach != "AI" {
continue
}
if t.ID < 265 {
continue
}
id := strconv.Itoa(int(t.ID))

roster := GetAllCollegePlayersByTeamId(id)
Expand Down
65 changes: 19 additions & 46 deletions managers/ImportManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ func ImportCFBGames(isSpringGames bool) {
func ImportNFLGames() {
db := dbprovider.GetInstance().GetDB()

path := "C:\\Users\\ctros\\go\\src\\github.com\\CalebRose\\SimFBA\\data\\2026\\2026_nfl_postseason_games.csv"
path := "C:\\Users\\ctros\\go\\src\\github.com\\CalebRose\\SimFBA\\data\\2027\\2027_nfl_regularseason_games.csv"

gamesCSV := util.ReadCSV(path)

Expand Down Expand Up @@ -504,14 +504,19 @@ func ImportNFLGames() {
awayTeamCoach = "AI"
}
timeSlot := row[12]
isNeutralSite := util.ConvertStringToBool(row[5])
// Need to implement Stadium ID
stadium := ht.Stadium
city := ht.City
state := ht.State
if isNeutralSite {
stadium = row[13]
city = row[14]
state = row[15]
}
// Need to check for if a game is in a domed stadium or not
isConferenceGame := ht.ConferenceID == at.ConferenceID
isDivisionGame := ht.DivisionID == at.DivisionID && ht.DivisionID > 0
isNeutralSite := util.ConvertStringToBool(row[5])
isPreseasonGame := util.ConvertStringToBool(row[6])
// isConferenceChampionship := util.ConvertStringToBool(row[7])
isPlayoffGame := util.ConvertStringToBool(row[8])
Expand Down Expand Up @@ -562,38 +567,31 @@ func ImportNFLGames() {
func ImportCFBTeams() {
db := dbprovider.GetInstance().GetDB()

teamPath := "C:\\Users\\ctros\\go\\src\\github.com\\CalebRose\\SimFBA\\data\\2027\\teams.csv"
// teamPath := "C:\\Users\\ctros\\go\\src\\github.com\\CalebRose\\SimFBA\\data\\2027\\teams.csv"
stadiumPath := "C:\\Users\\ctros\\go\\src\\github.com\\CalebRose\\SimFBA\\data\\2027\\stadia.csv"
// profilePath := "C:\\Users\\ctros\\go\\src\\github.com\\CalebRose\\SimFBA\\data\\2027\\profiles.csv"

teamCSV := util.ReadCSV(teamPath)
// teamCSV := util.ReadCSV(teamPath)
stadiumCSV := util.ReadCSV(stadiumPath)
// profileCSV := util.ReadCSV(profilePath)

for idx, row := range teamCSV {
for idx, row := range stadiumCSV {
if idx == 0 {
continue
}

stadiumRecord := stadiumCSV[idx]
// profileRecord := profileCSV[idx]

teamID := util.ConvertStringToInt(row[0])
stadiumID := util.ConvertStringToInt(stadiumRecord[0])
stadiumName := stadiumRecord[1]
capacity := util.ConvertStringToInt(stadiumRecord[8])
recordAtt := util.ConvertStringToInt(stadiumRecord[9])
teamName := row[1]
mascot := row[2]
abbr := row[3]
teamID := 0
stadiumID := util.ConvertStringToInt(row[0])
stadiumName := row[1]
capacity := util.ConvertStringToInt(row[8])
recordAtt := util.ConvertStringToInt(row[9])
abbr := ""
city := row[4]
state := row[5]
country := "USA"
conferenceID := util.ConvertStringToInt(row[7])
conference := row[8]
country := row[6]
firstSeason := 2027
isFBS := false
isActive := false

stadium := structs.Stadium{
Model: gorm.Model{
Expand All @@ -608,33 +606,9 @@ func ImportCFBTeams() {
Capacity: uint(capacity),
RecordAttendance: uint(recordAtt),
FirstSeason: uint(firstSeason),
LeagueID: 2,
LeagueName: "FCS",
}

team := structs.CollegeTeam{
Model: gorm.Model{
ID: uint(teamID),
},
BaseTeam: structs.BaseTeam{
TeamName: teamName,
Mascot: mascot,
TeamAbbr: abbr,
City: city,
State: state,
Country: country,
StadiumID: uint(stadiumID),
Stadium: stadiumName,
RecordAttendance: recordAtt,
Enrollment: 0,
FirstPlayed: firstSeason,
},
ConferenceID: conferenceID,
Conference: conference,
IsFBS: isFBS,
IsActive: isActive,
LeagueID: 3,
LeagueName: "NFL",
}

// aiBehavior := profileRecord[10]
// aiQuality := profileRecord[11]
// min := util.ConvertStringToInt(profileRecord[12])
Expand Down Expand Up @@ -671,7 +645,6 @@ func ImportCFBTeams() {
// DefensiveScheme: def,
// }

db.Create(&team)
db.Create(&stadium)
// db.Create(&teamProfile)
}
Expand Down
Loading
Loading