Skip to content

Commit

Permalink
Transfer portal API fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CalebRose committed May 22, 2024
1 parent aff66df commit dc78b98
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 33 deletions.
3 changes: 3 additions & 0 deletions dbprovider/dbprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,16 @@ func (p *Provider) InitDatabase() bool {
// db.AutoMigrate(&structs.Stadium{})

// College

// db.AutoMigrate(&structs.CollegePlayer{})
// db.AutoMigrate(&structs.HistoricCollegePlayer{})
// db.AutoMigrate(&structs.TransferPortalProfile{})
// db.AutoMigrate(&structs.Player{})
// db.AutoMigrate(&structs.CollegePlayerSeasonStats{})
// db.AutoMigrate(&structs.CollegePlayerStats{})
// db.AutoMigrate(&structs.CollegePlayerGameSnaps{})
// db.AutoMigrate(&structs.CollegePlayerSeasonSnaps{})
// db.AutoMigrate(&structs.CollegePromise{})
// db.AutoMigrate(&structs.UnsignedPlayer{})
// db.AutoMigrate(&structs.CollegeTeam{})
// db.AutoMigrate(&structs.CollegeRival{})
Expand Down
66 changes: 33 additions & 33 deletions managers/GameplanManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -3198,39 +3198,39 @@ func SetAIGameplan() {
func FixBrokenGameplans() {
db := dbprovider.GetInstance().GetDB()

// collegeTeams := GetAllCollegeTeams()
// gameplanMap := GetCollegeGameplanMap()
// recruitingProfileMap := GetTeamProfileMap()

// for _, t := range collegeTeams {
// id := strconv.Itoa(int(t.ID))
// gp := gameplanMap[t.ID]
// rtp := *recruitingProfileMap[id]

// dc := GetDepthchartByTeamID(id)

// isBroken := false

// players := dc.DepthChartPlayers
// for _, dcp := range players {
// p := dcp.CollegePlayer
// if p.IsRedshirting || (p.IsInjured && p.WeeksOfRecovery > 0) {
// isBroken = true
// break
// }
// }

// if isBroken {
// // Penalize CFB Team
// rtp.SubtractScholarshipsAvailable()
// repository.SaveRecruitingTeamProfile(rtp, db)
// t.MarkTeamForPenalty()
// repository.SaveCFBTeam(t, db)

// // Autosort Depth Chart
// ReAlignCollegeDepthChart(db, id, gp)
// }
// }
collegeTeams := GetAllCollegeTeams()
gameplanMap := GetCollegeGameplanMap()
recruitingProfileMap := GetTeamProfileMap()

for _, t := range collegeTeams {
id := strconv.Itoa(int(t.ID))
gp := gameplanMap[t.ID]
rtp := *recruitingProfileMap[id]

dc := GetDepthchartByTeamID(id)

isBroken := false

players := dc.DepthChartPlayers
for _, dcp := range players {
p := dcp.CollegePlayer
if p.IsRedshirting || (p.IsInjured && p.WeeksOfRecovery > 0) {
isBroken = true
break
}
}

if isBroken {
// Penalize CFB Team
rtp.SubtractScholarshipsAvailable()
repository.SaveRecruitingTeamProfile(rtp, db)
t.MarkTeamForPenalty()
repository.SaveCFBTeam(t, db)

// Autosort Depth Chart
ReAlignCollegeDepthChart(db, id, gp)
}
}

nflTeams := GetAllNFLTeams()

Expand Down
1 change: 1 addition & 0 deletions structs/TransferPortal.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ func (c *TransferPlayerResponse) Map(r CollegePlayer, ovr string) {
c.FirstName = r.FirstName
c.LastName = r.LastName
c.Position = r.Position
c.Archetype = r.Archetype
c.Height = r.Height
c.Weight = r.Weight
c.Stars = r.Stars
Expand Down

0 comments on commit dc78b98

Please sign in to comment.