Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.4.0 #51

Merged
merged 23 commits into from
Dec 22, 2023
Merged

2.4.0 #51

merged 23 commits into from
Dec 22, 2023

Conversation

fewieden
Copy link
Owner

Updated module to work with the new NHL API.

fewieden and others added 23 commits October 2, 2023 22:35
This gets most pieces of the module back into working order with the new API.

I haven't found any way of determining how much time is left in a period, so that still needs to be figured out. I'm also not sure what the CRIT gameState is, but it seems to be "game almost over". Periods are missing their ordinal suffix right now, so they're just numbers rather than "1st" or "2nd".

I don't know what a postponed game state is, either, so that is still TBD.

I have yet to find any details on endpoints for playoff series information, so while I can query last season's playoff games, I am not sure how to query for the full playoff series details.

Fixes #49
I broke this after a late edit while preparing the change to be committed.
This is how the module is expecting to handle the period.
As much as we can, anyway. The API only gives us back about a week's worth of games.
This will return all games that take place on the day that you define as daysAhead. My previous implementation would return all games happening at (now + days ahead) which meant it would take the current time into consideration. Now the time is dropped so if daysAhead were 1, you'd see all games happening any time today and any time tomorrow (plus whatever daysInPast is set to).
I think this will work, but I need to wait until a game is live before being certain. This fetches all current scores, which includes game clock information, and applies the clock info to games that are in progress. Furthermore, if we aren't able to retrieve the time remaining, we will just display the period number the same way that "Final" or date/time is already displayed.
This allows the template to change minimally. Since we're already transforming the received data into a different object for presentation, it makes sense to keep things consistent where possible.
This endpoint is being incredibly slow today, and once we've loaded it we probably don't need to load it again.
The scores endpoint only returns games for the requested day, so we need to use today, not startDate.
Don't show "Final" during crit, just show the score as normal.
@fewieden
Copy link
Owner Author

@parnic @dannoh I made some more modifications. It would be great if you could give this a check during live games before I put it on master.

@parnic
Copy link
Contributor

parnic commented Dec 17, 2023

Looks like it's showing correct information for the live games tonight. I did see a "4th" once, either last night or earlier today, but that was still in my branch and I'm not sure what caused it.

This all seems to be working for me :)

@fewieden fewieden merged commit c251fd7 into master Dec 22, 2023
4 checks passed
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