mirror of
https://github.com/nprasad2077/NBA_Go.git
synced 2026-09-23 06:25:14 +00:00
advanced models/controllers/service docs update
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
||||
"gorm.io/gorm/clause"
|
||||
)
|
||||
|
||||
func FetchAndStorePlayerAdvancedStats(db *gorm.DB, season int) error {
|
||||
func FetchAndStorePlayerAdvancedStats(db *gorm.DB, season int, isPlayoff bool) error {
|
||||
metrics.DBOperationsTotal.WithLabelValues("fetch", "player_advanced").Inc()
|
||||
url := fmt.Sprintf("http://rest.nbaapi.com/api/PlayerDataAdvanced/query?season=%d&sortBy=Points&ascending=false&pageNumber=1&pageSize=1000", season)
|
||||
|
||||
@@ -28,9 +28,10 @@ func FetchAndStorePlayerAdvancedStats(db *gorm.DB, season int) error {
|
||||
for _, stat := range stats {
|
||||
// Ensure the season is included from the query param
|
||||
stat.Season = season
|
||||
stat.IsPlayoff = isPlayoff
|
||||
|
||||
err := db.Clauses(clause.OnConflict{
|
||||
Columns: []clause.Column{{Name: "player_id"}, {Name: "season"}, {Name: "team"}},
|
||||
Columns: []clause.Column{{Name: "player_id"}, {Name: "season"}, {Name: "team"}, {Name: "is_playoff"}},
|
||||
DoUpdates: clause.AssignmentColumns([]string{
|
||||
"external_id", "player_name", "position", "age", "games",
|
||||
"minutes_played", "per", "ts_percent", "three_par", "ftr",
|
||||
|
||||
Reference in New Issue
Block a user