Skip to content

Commit

Permalink
autodetect roundsTotalNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniokov committed Mar 3, 2017
1 parent b8ba6e4 commit 2941d1e
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 16 deletions.
4 changes: 2 additions & 2 deletions dist/replay-table.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/replay-table.css.map

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

2 changes: 1 addition & 1 deletion dist/replay-table.js.map

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions dist/replay-table.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"devDependencies": {
"gh-pages": "^0.12.0",
"react-scripts": "0.7.0"
"react-scripts": "0.9.3"
},
"dependencies": {
"babyparse": "^0.4.6",
Expand Down
2 changes: 1 addition & 1 deletion src/app/TableContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class TableContainer extends Component {

showProgressBar={this.props.showProgressBar}
progressBarValue={this.state.currentRound}
progressBarMaxValue={this.props.roundsTotalNumber || this.props.resultsTable.length - 1}
progressBarMaxValue={this.props.roundsTotalNumber}

tableName={this.props.tableName} />
);
Expand Down
5 changes: 5 additions & 0 deletions src/config/сonfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ export default class Config {
.filter(round => [...round.results.values()].some(result => result.change !== null))
.reduce((maxIndex, round) => Math.max(round.meta.index, maxIndex), 0);


if (!this.obj.roundsTotalNumber) {
this.obj.roundsTotalNumber = data.roundsNames.length - 1;
}

this.obj.startFromRound = this.obj.startFromRound || this.obj.lastRound;

return this;
Expand Down
2 changes: 1 addition & 1 deletion src/transformers/auxiliary/addRoundMetadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default function (round, name, index) {
leader: [...round.keys()][0],
areAllResultsMapped: [...round.values()].every(result => !!result.result || result.change === null),
maxAbsChange: Math.max(...[...round.values()].map(result => Math.abs(result.change))),
changesSum: [...round.values()].reduce((sum, result) => sum + (result || 0), 0)
changesSum: [...round.values()].reduce((sum, result) => sum + (result.change || 0), 0)
};

return {
Expand Down

0 comments on commit 2941d1e

Please sign in to comment.