Livescoreboard live rink - #2
Conversation
CalebRose
left a comment
There was a problem hiding this comment.
Reviewed the code - it looks there's a mix of functions used for testing and some logic that we may be able to refactor a bit.
Let's go over the comments and go from there?
| } | ||
| db.Where("game_id IN ?", gameIDs).Find(&allPbPs) | ||
|
|
||
| for _, p := range allPbPs { |
There was a problem hiding this comment.
So this code does make sense. I'm curious, why not use the GenerateCHLPlayByPlayResponse function from StatsManager.go?
There was a problem hiding this comment.
Primarily a performance reason and insurance that final box scores aren't impacted by in case of a crash/live playback issue. Could be stripped back and use GenerateCHLPlayByPlayResponse instead
| } | ||
| db.Where("game_id IN ?", gameIDs).Find(&allPbPs) | ||
|
|
||
| for _, p := range allPbPs { |
There was a problem hiding this comment.
See above, but for GeneratePHLPlayByPlayResponse
There was a problem hiding this comment.
Same as above
|
|
||
| if isCollege { | ||
| clauses := repository.GamesClauses{SeasonID: seasonID, WeekID: weekID, IsPreseason: ts.IsPreseason} | ||
| games := repository.FindCollegeGames(clauses) |
There was a problem hiding this comment.
It looks like this function has a lot in common with GetCHLPlayByPlayStreamData. Asking for clarity, is there a reason why we're using this function as opposed to that one?
There was a problem hiding this comment.
Good point. Even refactored it into a PBP Manager now. Did have to alter a few files but should be cleaner and make changes easier long term. Ran a "go mod tidy" too and it cleaned up a few files that way.
| ) | ||
|
|
||
| // StartLiveScoreboardSession spins up active games and routes JSON payloads to the frontend | ||
| func StartLiveScoreboardSession(ctx context.Context, leagueType string, gameLimit int, outChannel chan<- string) { |
There was a problem hiding this comment.
Yeah. Will write it out
| } | ||
|
|
||
| // GetEventName translates integer Event IDs to string constants | ||
| func GetEventName(eventID uint8) string { |
There was a problem hiding this comment.
I think we have a function in util that handles getting the event name. Can we check playByPlayUtil.go for the function?
There was a problem hiding this comment.
I tried using this, but I kept running into a constant loop of util errors and so I for now gave up so I could test further. If you've a suggestion then let me know
CalebRose/simsn-interface-v2#231
Relevant Linked work for LiveRink feature