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

Add projected points to Boxscore for the current matchup period #234

Merged
merged 2 commits into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "espn-fantasy-football-api",
"version": "1.5.0",
"version": "1.6.0",
"description": "A Javascript API to connect to ESPN's fantasy football API",
"main": "web.js",
"files": [
Expand Down
6 changes: 6 additions & 0 deletions src/boxscore/boxscore.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ class Boxscore extends BaseObject {
* @typedef {object} BoxscoreMap
*
* @property {number} homeScore The total points scored by the home team.
* @property {number} homeProjectedScore The projected total points scored by the home team.
* NOTE: This field is only populated in the boxscore for the current matchup period!
* @property {number} homeTeamId The home team's id. Can be used to load a cached Team.
* @property {BoxscorePlayer[]} homeRoster The home team's roster, containing player info and
* stats.
*
* @property {number} awayScore The total points scored by the away team.
* @property {number} awayProjectedScore The projected total points scored by the away team.
* NOTE: This field is only populated in the boxscore for the current matchup period!
* @property {number} awayTeamId The away team's id. Can be used to load a cached Team.
* @property {BoxscorePlayer[]} awayRoster The away team's roster, containing player info and
* stats.
Expand All @@ -36,6 +40,7 @@ class Boxscore extends BaseObject {
_.get(responseData, 'totalPointsLive') || _.get(responseData, 'totalPoints')
)
},
homeProjectedScore: 'home.totalProjectedPointsLive',
homeTeamId: 'home.teamId',
homeRoster: {
key: 'home.rosterForCurrentScoringPeriod.entries',
Expand All @@ -52,6 +57,7 @@ class Boxscore extends BaseObject {
_.get(responseData, 'totalPointsLive') || _.get(responseData, 'totalPoints')
)
},
awayProjectedScore: 'away.totalProjectedPointsLive',
awayTeamId: 'away.teamId',
awayRoster: {
key: 'away.rosterForCurrentScoringPeriod.entries',
Expand Down