Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update - Assignment Editing #338

Merged
merged 2 commits into from
Aug 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions app/content/assignments/players.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,24 @@
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,
Expand All @@ -95,7 +97,7 @@
}, [assignmentList]);

const [loadingDelete, setLoadingDelete] = useState(false);
const handleDelete = useCallback(

Check warning on line 100 in app/content/assignments/players.js

View workflow job for this annotation

GitHub Actions / prettier-check

React Hook useCallback received a function whose dependencies are unknown. Pass an inline function instead
once(async () => {
setLoadingDelete(true);
try {
Expand Down Expand Up @@ -149,6 +151,7 @@
await invalidateMultipleKeys(queryClient, invalidateKeys);
showSnackBar("Assignments Deleted");
setLoadingDelete(false);
setEditing(false);
} catch (e) {
console.log("Error deleting assignments: ", e);
showDialog("Error", getErrorString(e));
Expand Down
Loading