From c954cc7923707b591c00c5c734efca659ceb7d8d Mon Sep 17 00:00:00 2001 From: Daniel LaCosse <3759828+daniellacosse@users.noreply.github.com> Date: Wed, 16 Oct 2024 12:18:59 -0400 Subject: [PATCH] don't use reduce lol --- server_manager/www/app.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/server_manager/www/app.ts b/server_manager/www/app.ts index 18d9902588..f834b708fa 100644 --- a/server_manager/www/app.ts +++ b/server_manager/www/app.ts @@ -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(