Skip to content

Commit

Permalink
handled special cases in ESPN feed, and adjusted formatting of rankin…
Browse files Browse the repository at this point in the history
…g badge.
  • Loading branch information
jclarke0000 committed Nov 22, 2017
1 parent 44afb75 commit 9500eee
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 18 deletions.
12 changes: 6 additions & 6 deletions MMM-MyScoreboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@
font-size: 12px;
font-weight: bold;
line-height: 13px;
background-color: #666;
color: #FFF;
background-color: #FFF;
color: #000;
padding: 0 2px 0 3px;
height: 13px;
border-radius: 2px;
Expand All @@ -171,8 +171,8 @@
line-height: 13px;
padding: 0 2px;
height: 13px;
background-color: #333;
color: #FFF;
background-color: #FFF;
color: #000;
border-radius: 2px;
font-weight: bold;
}
Expand All @@ -189,7 +189,7 @@
.MMM-MyScoreboard .wrapper.colored .box-score .logo .ranking,
.MMM-MyScoreboard .wrapper.colored .box-score .team-name .ranking,
.MMM-MyScoreboard .wrapper.colored .box-score .team-short-code .ranking {
background-color: #37677B;
background-color: #C0FF00;
}

.MMM-MyScoreboard .wrapper.colored .box-score.in-progress .status {
Expand Down Expand Up @@ -422,7 +422,7 @@

.MMM-MyScoreboard .box-score.oneLine .team-short-code,
.MMM-MyScoreboard .box-score.oneLineWithLogos .team-short-code {
width: 60px;
width: 57px;
color: #AAA;
}

Expand Down
37 changes: 25 additions & 12 deletions providers/ESPN.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,14 @@ module.exports = {
moment(gameDate).format("YYYYMMDD") + "&limit=200";

/*
by default, ESPN returns only the Top 25 ranked teams for NCAAM.
If we append "&groups=50" (in the URL when you view the scores
on ESPN.com) we get all the games.
*/
if (league == "NCAAM") {
by default, ESPN returns only the Top 25 ranked teams for NCAAF
and NCAAM. By appending the group parameter (80 for NCAAF and 50
for NCAAM, found in the URL of their respective scoreboard pages
on ESPN.com) we'll get the entire game list.
*/
if (league == "NCAAF") {
url = url + "&groups=80";
} else if (league == "NCAAM") {
url = url + "&groups=50";
}

Expand Down Expand Up @@ -265,16 +268,26 @@ module.exports = {
vTeamData.team.abbreviation = "SDSU ";
}

//determine which display name to use
var hTeamLong = "";
var vTeamLong = "";
//For college sports, use the displayName property
if (league == "NCAAF" || league == "NCAAM") {
hTeamLong = (hTeamData.team.abbreviation == undefined ? "" : hTeamData.team.abbreviation + " ") + hTeamData.team.name;
vTeamLong = (vTeamData.team.abbreviation == undefined ? "" : vTeamData.team.abbreviation + " ") + vTeamData.team.name;
} else { //use the shortDisplayName property
hTeamLong = hTeamData.team.shortDisplayName;
vTeamLong = vTeamData.team.shortDisplayName;
}


formattedGamesList.push({
classes: classes,
gameMode: gameState,
hTeam: hTeamData.team.abbreviation,
vTeam: vTeamData.team.abbreviation,
/*
For college sports, include the shortcode in the long team name
*/
hTeamLong: (league == "NCAAF" || league == "NCAAM" ? hTeamData.team.abbreviation + " " : "") + hTeamData.team.shortDisplayName,
vTeamLong: (league == "NCAAF" || league == "NCAAM" ? vTeamData.team.abbreviation + " " : "") + vTeamData.team.shortDisplayName,
hTeam: hTeamData.team.abbreviation == undefined ? hTeamData.team.name.substring(0,4).toUpperCase() + " " : hTeamData.team.abbreviation,
vTeam: vTeamData.team.abbreviation == undefined ? vTeamData.team.name.substring(0,4).toUpperCase() + " " : vTeamData.team.abbreviation,
hTeamLong: hTeamLong,
vTeamLong: vTeamLong,
hTeamRanking: (league == "NCAAF" || league == "NCAAM") ? self.formatT25Ranking(hTeamData.curatedRank.current) : null,
vTeamRanking: (league == "NCAAF" || league == "NCAAM") ? self.formatT25Ranking(vTeamData.curatedRank.current) : null,
hScore: parseInt(hTeamData.score),
Expand Down

0 comments on commit 9500eee

Please sign in to comment.