Skip to content

Commit

Permalink
Fix GameStateScrubber.percentageWatched returning +/-Infinity
Browse files Browse the repository at this point in the history
  • Loading branch information
beheh committed Aug 21, 2016
1 parent 8ae2a05 commit d0aaac0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Show current stats when hovering entities
- Fix launcher example in README.md
- Fix default card art endpoint
- Fix GameStateScrubber.percentageWatched returning +/-Infinity

### Changed
- Don't unexhaust hero powers when hovering
Expand Down
6 changes: 5 additions & 1 deletion ts/state/GameStateScrubber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,10 @@ export default class GameStateScrubber extends Stream.Duplex implements StreamSc
}

public get percentageWatched():number {
return 100 / Math.floor(this.getDuration()) * this.secondsWatched;
let percentage = 100 / Math.floor(this.getDuration()) * this.secondsWatched;
if(!isFinite(percentage)) {
percentage = 0;
}
return percentage;
}
}

0 comments on commit d0aaac0

Please sign in to comment.