Skip to content

Livescoreboard live rink - #2

Merged
CalebRose merged 8 commits into
mainfrom
Livescoreboard-LiveRink
Jun 12, 2026
Merged

Livescoreboard live rink#2
CalebRose merged 8 commits into
mainfrom
Livescoreboard-LiveRink

Conversation

@ChrisSaterra

Copy link
Copy Markdown
Collaborator

CalebRose/simsn-interface-v2#231

Relevant Linked work for LiveRink feature

@CalebRose CalebRose left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Comment thread managers/GameManager.go Outdated
}
db.Where("game_id IN ?", gameIDs).Find(&allPbPs)

for _, p := range allPbPs {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this code does make sense. I'm curious, why not use the GenerateCHLPlayByPlayResponse function from StatsManager.go?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread managers/GameManager.go Outdated
}
db.Where("game_id IN ?", gameIDs).Find(&allPbPs)

for _, p := range allPbPs {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above, but for GeneratePHLPlayByPlayResponse

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Comment thread managers/GameManager.go

if isCollege {
clauses := repository.GamesClauses{SeasonID: seasonID, WeekID: weekID, IsPreseason: ts.IsPreseason}
games := repository.FindCollegeGames(clauses)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Written for testing?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Will write it out

}

// GetEventName translates integer Event IDs to string constants
func GetEventName(eventID uint8) string {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we have a function in util that handles getting the event name. Can we check playByPlayUtil.go for the function?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
CalebRose merged commit b7e0500 into main Jun 12, 2026
1 check passed
@CalebRose
CalebRose deleted the Livescoreboard-LiveRink branch June 12, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants