Skip to content

Commit

Permalink
fix(speed-chart): more accurate in acceleration
Browse files Browse the repository at this point in the history
  • Loading branch information
ElonH authored Jun 2, 2020
1 parent 077a7d2 commit 6308688
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/app/components/speed-chart/speed-chart.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,19 @@ export class RngSpeedChartComponent implements OnInit {
});
statsOut.pipe(pairwise()).subscribe(([pre, cur]) => {
if (pre[1].length !== 0 || cur[1].length !== 0) return;
this.speedDiff = Math.round(cur[0]['core-stats'].speed - pre[0]['core-stats'].speed);
let preSpeed = 0;
let curSpeed = 0;
if (pre[0]['core-stats'].transferring) {
pre[0]['core-stats'].transferring.forEach(x => {
if (x.speed) preSpeed += x.speed;
});
}
if (cur[0]['core-stats'].transferring) {
cur[0]['core-stats'].transferring.forEach(x => {
if (x.speed) curSpeed += x.speed;
});
}
this.speedDiff = Math.round(curSpeed - preSpeed);
});
}
}

0 comments on commit 6308688

Please sign in to comment.