Skip to content

Commit

Permalink
Merge pull request #249 from cmu15122/alexb/filtering
Browse files Browse the repository at this point in the history
Filtering fixed
  • Loading branch information
jacksontromero authored Oct 9, 2023
2 parents 8620d66 + 317a48e commit 6e9785e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions client/src/components/home/ta/StudentEntries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,17 @@ export default function StudentEntries(props) {

useEffect(() => {
setIsHelping(false);
for (const [index, student] of allStudents.entries()) {
for (const [index, student] of filteredStudents.entries()) {
if (student.status === StudentStatusValues.BEING_HELPED && student.helpingTAInfo?.taAndrewID === userData.andrewID) {
setHelpIdx(index);
setIsHelping(true);
}
}
}, [allStudents, userData.andrewID]);
}, [filteredStudents, userData.andrewID]);

const handleClickHelp = (index) => {
HomeService.helpStudent(JSON.stringify({
andrewID: allStudents[index].andrewID,
andrewID: filteredStudents[index].andrewID,
})).then((res) => {
if (res.status === 200) {
setHelpIdx(index);
Expand All @@ -116,7 +116,7 @@ export default function StudentEntries(props) {

const handleCancel = (index) => {
HomeService.unhelpStudent(JSON.stringify({
andrewID: allStudents[index].andrewID,
andrewID: filteredStudents[index].andrewID,
})).then((res) => {
if (res.status === 200) {
setHelpIdx(-1);
Expand All @@ -127,15 +127,15 @@ export default function StudentEntries(props) {

const removeStudent = (index, doneHelping) => {
HomeService.removeStudent(JSON.stringify({
andrewID: allStudents[index].andrewID,
andrewID: filteredStudents[index].andrewID,
doneHelping: doneHelping,
}));
};

const handleClickUnfreeze = (index) => {
setIsHelping(false);
setHelpIdx(-1);
allStudents[index].status = StudentStatusValues.WAITING;
filteredStudents[index].status = StudentStatusValues.WAITING;
};

/* END QUEUE LOGIC */
Expand Down

0 comments on commit 6e9785e

Please sign in to comment.