diff --git a/teachertool/src/components/CatalogModal.tsx b/teachertool/src/components/CatalogModal.tsx index c196d1f89738..b8896cf91df6 100644 --- a/teachertool/src/components/CatalogModal.tsx +++ b/teachertool/src/components/CatalogModal.tsx @@ -7,6 +7,7 @@ import { Modal } from "react-common/components/controls/Modal"; import { hideModal } from "../transforms/hideModal"; import { addCriteriaToRubric } from "../transforms/addCriteriaToRubric"; import { CatalogCriteria } from "../types/criteria"; +import { getSelectableCatalogCriteria } from "../state/helpers"; interface IProps {} @@ -53,6 +54,8 @@ export const CatalogModal: React.FC = ({}) => { }, ]; + const selectableCatalogCriteria = getSelectableCatalogCriteria(); + return teacherTool.modal === "catalog-display" ? ( = ({}) => { onClose={closeModal} actions={modalActions} > - {teacherTool.catalog?.map(criteria => { + {selectableCatalogCriteria.map(criteria => { return ( criteria?.template && ( c.catalogCriteriaId) ?? []; + + // Return a criteria as selectable if it has parameters (so it can be used multiple times in a rubric) + // or if it has not yet been used in the active rubric. + return ( + state.catalog?.filter( + catalogCriteria => + (catalogCriteria.parameters && catalogCriteria.parameters.length > 0) || + !usedCriteria.includes(catalogCriteria.id) + ) ?? [] + ); +}