From 42def8498e10f9ed317f5a1833cd61dc8ed8d681 Mon Sep 17 00:00:00 2001 From: CalebRose Date: Tue, 5 Nov 2024 15:30:41 -0800 Subject: [PATCH] fixing stats page call for historical data by game type --- managers/PlayerManager.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/managers/PlayerManager.go b/managers/PlayerManager.go index 0dcbc50..a8b0d35 100644 --- a/managers/PlayerManager.go +++ b/managers/PlayerManager.go @@ -333,13 +333,13 @@ func GetAllCollegePlayersWithStatsBySeasonID(cMap map[int]int, cNMap map[int]str // var distinctCollegeStats []structs.CollegePlayerStats var distinctCollegeStats []structs.CollegePlayerSeasonStats - db.Distinct("college_player_id").Where("snaps > 0 AND season_id = ?", seasonID).Find(&distinctCollegeStats) + db.Distinct("college_player_id").Where("snaps > 0 AND season_id = ? AND game_type = ?", seasonID, gameType).Find(&distinctCollegeStats) distinctCollegePlayerIDs := GetCollegePlayerIDsBySeasonStats(distinctCollegeStats) if viewType == "SEASON" { db.Preload("SeasonStats", func(db *gorm.DB) *gorm.DB { - return db.Where("season_id = ?", seasonID) + return db.Where("season_id = ? AND game_type = ?", seasonID, gameType) }).Where("id in ?", distinctCollegePlayerIDs).Find(&collegePlayers) } else { db.Preload("Stats", func(db *gorm.DB) *gorm.DB { @@ -383,7 +383,7 @@ func GetAllCollegePlayersWithStatsBySeasonID(cMap map[int]int, cNMap map[int]str if viewType == "SEASON" { db.Preload("SeasonStats", func(db *gorm.DB) *gorm.DB { - return db.Where("season_id = ?", seasonID) + return db.Where("season_id = ? AND game_type = ?", seasonID, gameType) }).Where("id in ?", distinctCollegePlayerIDs).Find(&historicCollegePlayers) } else { db.Preload("Stats", func(db *gorm.DB) *gorm.DB { @@ -439,7 +439,7 @@ func GetAllNFLPlayersWithStatsBySeasonID(cMap, dMap map[int]int, cNMap, dNMap ma if viewType == "SEASON" { db.Preload("SeasonStats", func(db *gorm.DB) *gorm.DB { - return db.Where("season_id = ?", seasonID) + return db.Where("season_id = ? AND game_type = ?", seasonID, gameType) }).Where("id in ?", distinctCollegePlayerIDs).Find(&nflPlayers) } else { db.Preload("Stats", func(db *gorm.DB) *gorm.DB { @@ -483,7 +483,7 @@ func GetAllNFLPlayersWithStatsBySeasonID(cMap, dMap map[int]int, cNMap, dNMap ma if viewType == "SEASON" { db.Preload("SeasonStats", func(db *gorm.DB) *gorm.DB { - return db.Where("season_id = ?", seasonID) + return db.Where("season_id = ? AND game_type = ?", seasonID, gameType) }).Where("id in ?", distinctCollegePlayerIDs).Find(&historicNFLPlayers) } else { db.Preload("Stats", func(db *gorm.DB) *gorm.DB {