Skip to content

Commit

Permalink
fix null players bug (#50)
Browse files Browse the repository at this point in the history
Fix for issue #49
  • Loading branch information
nmelhado authored Aug 27, 2021
1 parent 79708d0 commit 94381b5
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

All notable changes to this project will be documented in this file.

## [1.0.5] - 2021-08-26

### Fixed

- Some league rosters return null for the players, which breaks power rankings and the rosters page
- Bug reported in [issue #49](https://github.com/nmelhado/league-page/issues/49)
- For rosters, only compute the bench if the players field is valid
- For power rankings, skip teams with no players (if no teams have players, don't display the graph)

## [1.0.4] - 2021-08-25

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "league-page",
"version": "1.0.4",
"version": "1.0.5",
"homepage": "https://github.com/nmelhado/league-page#readme",
"author": {
"name": "Nicholas Melhado",
Expand Down
15 changes: 12 additions & 3 deletions src/lib/PowerRankings/PowerRankingsDisplay.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@
let max = 0;
let validGraph = false;
for(const roster of rosters) {
// make sure the roster has players on it
if(!roster.players) continue;
// if at least one team has players, create the graph
validGraph = true;
const rosterPlayers = [];
for(const rosterPlayer of roster.players) {
Expand Down Expand Up @@ -96,6 +103,8 @@
}
</style>
<div class="enclosure" bind:this={el}>
<BarChart {maxWidth} {graphs} bind:curGraph={curGraph} />
</div>
{#if validGraph}
<div class="enclosure" bind:this={el}>
<BarChart {maxWidth} {graphs} bind:curGraph={curGraph} />
</div>
{/if}
5 changes: 4 additions & 1 deletion src/lib/Rosters/Roster.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@
}
$: finalStarters = digestData(roster.starters, true);
$: finalBench = digestData(roster.players);
let finalBench = [];
$: if(roster.players) {
finalBench = digestData(roster.players);
}
let finalIR = null;
if(roster.reserve) {
finalIR = digestData(roster.reserve, false, true);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ available for your copy of League Page
*/

// Keep in sync with package.json
export const version = "1.0.4";
export const version = "1.0.5";

0 comments on commit 94381b5

Please sign in to comment.