From c19ff55bbbdc55aa3b70930e096cfe18fd4d7a9a Mon Sep 17 00:00:00 2001 From: Jake Gehrke Date: Wed, 21 Aug 2024 17:14:49 -0700 Subject: [PATCH 1/2] add - editing set to false upon delete button press --- app/content/assignments/players.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/content/assignments/players.js b/app/content/assignments/players.js index 098ce252..8b381fd2 100644 --- a/app/content/assignments/players.js +++ b/app/content/assignments/players.js @@ -149,6 +149,7 @@ function Index() { await invalidateMultipleKeys(queryClient, invalidateKeys); showSnackBar("Assignments Deleted"); setLoadingDelete(false); + setEditing(false); } catch (e) { console.log("Error deleting assignments: ", e); showDialog("Error", getErrorString(e)); From 76b2fde882e0cdcf6669d5fb64f3851dc02b2c2a Mon Sep 17 00:00:00 2001 From: Jake Gehrke Date: Wed, 21 Aug 2024 17:40:50 -0700 Subject: [PATCH 2/2] add - logic to navigate back if the assignment list is equal to 0 --- app/content/assignments/players.js | 34 ++++++++++++++++-------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/app/content/assignments/players.js b/app/content/assignments/players.js index 8b381fd2..7b07f27b 100644 --- a/app/content/assignments/players.js +++ b/app/content/assignments/players.js @@ -59,22 +59,24 @@ function Index() { time: assignment.assignedTime, rounded: true, }).getTime() == mergeTime && assignment.drillId === drillId; - setAssignmentList( - Object.values(userInfo) - .filter((user) => user.assigned_data.some(critera)) - .map((user) => { - const assignment = user.assigned_data.find(critera); - return { - name: user.name, - pfp: user.pfp, - role: user.role, - uid: user.uid, - completed: assignment.completed, - attemptId: assignment.attemptId, - markedForDelete: false, - }; - }), - ); + const updatedAssignmentList = Object.values(userInfo) + .filter((user) => user.assigned_data.some(critera)) + .map((user) => { + const assignment = user.assigned_data.find(critera); + return { + name: user.name, + pfp: user.pfp, + role: user.role, + uid: user.uid, + completed: assignment.completed, + attemptId: assignment.attemptId, + markedForDelete: false, + }; + }); + + updatedAssignmentList.length === 0 + ? navigation.goBack() + : setAssignmentList(updatedAssignmentList); } }, [ userInfo,