diff --git a/rails/react-components/src/library/components/permission-forms-v2/students-tab/students-table.tsx b/rails/react-components/src/library/components/permission-forms-v2/students-tab/students-table.tsx index b1cc7ef47..a412261e8 100644 --- a/rails/react-components/src/library/components/permission-forms-v2/students-tab/students-table.tsx +++ b/rails/react-components/src/library/components/permission-forms-v2/students-tab/students-table.tsx @@ -151,6 +151,18 @@ export const StudentsTable = ({ classId, currentSelectedProject }: IProps) => { } }; + const getProjectForms = (allForms: IPermissionForm[], currentSelectedProject: CurrentSelectedProject ) => { + if (currentSelectedProject === "") { + return nonArchived(allForms); + } else { + // TODO: fix typing in CurrentSelectedProject and IPermissionForm.project_id that requires us to re-cast string + const project_id = parseInt(currentSelectedProject.toString()); + return allForms.filter(pf => pf.project_id === project_id); + } + }; + + const permissionFormsOfProject = getProjectForms(nonArchivedPermissionForms, currentSelectedProject); + return ( <>