Skip to content

Commit

Permalink
filter edit student forms modal forms by project
Browse files Browse the repository at this point in the history
  • Loading branch information
bacalj committed Jul 2, 2024
1 parent a3639da commit 25259cb
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,18 @@ export const StudentsTable = ({ classId, currentSelectedProject }: IProps) => {
}
};

const getProjectForms = (allForms: IPermissionForm[], currentSelectedProject: CurrentSelectedProject ) => {

Check failure on line 154 in rails/react-components/src/library/components/permission-forms-v2/students-tab/students-table.tsx

View workflow job for this annotation

GitHub Actions / Run react-components tests

'currentSelectedProject' is already declared in the upper scope on line 38 column 42
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());

Check failure on line 159 in rails/react-components/src/library/components/permission-forms-v2/students-tab/students-table.tsx

View workflow job for this annotation

GitHub Actions / Run react-components tests

Missing radix parameter
return allForms.filter(pf => pf.project_id === project_id);
}
};

const permissionFormsOfProject = getProjectForms(nonArchivedPermissionForms, currentSelectedProject);

return (
<>
<table className={`${css.studentsTable} ${permissionsExpanded ? css.expandedPermissions : ""}`}>
Expand Down Expand Up @@ -259,7 +271,7 @@ export const StudentsTable = ({ classId, currentSelectedProject }: IProps) => {
<ModalDialog borderColor="teal">
<EditStudentPermissionsForm
student={editStudent}
permissionForms={permissionForms}
permissionForms={permissionFormsOfProject}
onFormCancel={() => setEditStudent(null)}
onFormSave={handleSaveStudentPermissionsSuccess}
classId={classId}
Expand Down

0 comments on commit 25259cb

Please sign in to comment.