Skip to content

Commit

Permalink
don't use reduce lol
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellacosse committed Oct 16, 2024
1 parent 0abd5d8 commit c954cc7
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions server_manager/www/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1081,13 +1081,15 @@ export class App {
) {
const tunnelTimeByLocation = await selectedServer.getTunnelTimeByLocation();

serverView.totalUserHours = tunnelTimeByLocation.reduce(
(sum, {tunnel_time: {seconds}}) => sum + seconds / (60 * 60),
0
);
serverView.totalDevices = serverView.totalUserHours / (30 * 24);
let sum = 0;
for (const {
tunnel_time: {seconds},
} of tunnelTimeByLocation) {
sum += seconds / (60 * 60);
}

console.log(serverView);
serverView.totalUserHours = sum;
serverView.totalDevices = serverView.totalUserHours / (30 * 24);
}

private showTransferStats(
Expand Down

0 comments on commit c954cc7

Please sign in to comment.