From b6c891882ca531bf4787b3d948a5709b8b085d24 Mon Sep 17 00:00:00 2001
From: odinaa <odinaa@stud.ntnu.no>
Date: Sat, 18 May 2024 19:06:47 +0200
Subject: [PATCH] fixed re-call error with userpage, and hopefully improved the
 overview handler

---
 Backend/EgressAPI/handlers/overview.go               | 3 +--
 Backend/EgressAPI/other/structs.go                   | 2 +-
 Frontend/power-tracker/src/pages/adminUserConfig.tsx | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/Backend/EgressAPI/handlers/overview.go b/Backend/EgressAPI/handlers/overview.go
index 4224f1f..b05f207 100644
--- a/Backend/EgressAPI/handlers/overview.go
+++ b/Backend/EgressAPI/handlers/overview.go
@@ -93,7 +93,7 @@ func sortData(machines []other.MachineDetails, interval int64, since int64, star
 	}
 	//loop over each machine using a for loop
 	for k := range machines {
-		quickSort(machines[k].SensorDataList, 0, len(machines[k].SensorDataList)-1)
+		//quickSort(machines[k].SensorDataList, 0, len(machines[k].SensorDataList)-1)
 
 		var packetList []other.SensorData     //new list of packets
 		var tempPacketList []other.SensorData //temporary list of packets, to make sure it is averaged correctly
@@ -102,7 +102,6 @@ func sortData(machines []other.MachineDetails, interval int64, since int64, star
 		for _, tInterval := range intervalList {
 
 			for i < len(machines[k].SensorDataList) {
-				//println(i)
 				if machines[k].SensorDataList[i].DateTime.Before(startTime) { //if the packet has not yet reached the start time, go to next packet
 					i++
 					continue
diff --git a/Backend/EgressAPI/other/structs.go b/Backend/EgressAPI/other/structs.go
index 5ff4b45..6de182c 100644
--- a/Backend/EgressAPI/other/structs.go
+++ b/Backend/EgressAPI/other/structs.go
@@ -16,7 +16,7 @@ type UserInfo struct {
 	SessionToken string `json:"stoken"`
 }
 
-// IncomingRequest This struct is the top level for ALL requests coming from frontend, two members, user info and the body
+// IncomingRequest This struct is the top level for ALL requests coming from frontend, two members, user info and the body -- UNUSED --
 type IncomingRequest struct {
 	Uinfo UserInfo    `json:"uinfo"`
 	Body  interface{} `json:"body"`
diff --git a/Frontend/power-tracker/src/pages/adminUserConfig.tsx b/Frontend/power-tracker/src/pages/adminUserConfig.tsx
index 9138f3f..15c3236 100644
--- a/Frontend/power-tracker/src/pages/adminUserConfig.tsx
+++ b/Frontend/power-tracker/src/pages/adminUserConfig.tsx
@@ -102,7 +102,7 @@ function UserConfig() {
       setUserData(UserDat)
       setUsersToShow(UserDat)
     })
-  }, [userData]);
+  }, []);
 
   // when search term gets updated, redraw and filter list of users
   useEffect(() => {
-- 
GitLab