Skip to content
Merged
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
20 changes: 18 additions & 2 deletions managers/BootstrapManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ type BootstrapDataScheduling struct {
Stadiums []structs.Stadium
CFBGameRequests []structs.CFBGameRequest
NFLGameRequests []structs.NFLGameRequest
CollegeGameplanMap map[uint]structs.CollegeGameplan
NFLGameplanMap map[uint]structs.NFLGameplan
}

type BootstrapDataDraft struct {
Expand Down Expand Up @@ -455,9 +457,11 @@ func GetSchedulePageBootstrap(username, collegeID, seasonID string) BootstrapDat
stadiums []structs.Stadium
cfbGameRequests []structs.CFBGameRequest
nflGameRequests []structs.NFLGameRequest
cfbGameplanMap map[uint]structs.CollegeGameplan
nflGameplanMap map[uint]structs.NFLGameplan
)
if len(collegeID) > 0 && collegeID != "0" {
wg.Add(4)
wg.Add(5)
go func() {
defer wg.Done()
officialPolls = GetAllOfficialPolls()
Expand All @@ -474,8 +478,13 @@ func GetSchedulePageBootstrap(username, collegeID, seasonID string) BootstrapDat
defer wg.Done()
cfbGameRequests = repository.FindCFBGameRequestRecords(repository.SchedulerQuery{SeasonID: seasonID})
}()
go func() {
defer wg.Done()
gameplans := GetAllCollegeGameplans()
cfbGameplanMap = MakeCollegeGameplanMap(gameplans)
}()
}
wg.Add(3)
wg.Add(4)
go func() {
defer wg.Done()
log.Println("Fetching Retired Players...")
Expand All @@ -494,6 +503,11 @@ func GetSchedulePageBootstrap(username, collegeID, seasonID string) BootstrapDat
nflGameRequests = repository.FindNFLGameRequestRecords(repository.SchedulerQuery{SeasonID: seasonID})
log.Println("Fetched NFL Game Requests, count:", len(nflGameRequests))
}()
go func() {
defer wg.Done()
gameplans := GetAllNFLGameplans()
nflGameplanMap = MakeNFLGameplanMap(gameplans)
}()
wg.Wait()

return BootstrapDataScheduling{
Expand All @@ -504,6 +518,8 @@ func GetSchedulePageBootstrap(username, collegeID, seasonID string) BootstrapDat
Stadiums: stadiums,
CFBGameRequests: cfbGameRequests,
NFLGameRequests: nflGameRequests,
CollegeGameplanMap: cfbGameplanMap,
NFLGameplanMap: nflGameplanMap,
}
}

Expand Down
Loading