From e6dd4874904143710450e9c83d3059797f7ca77d Mon Sep 17 00:00:00 2001 From: Arif-tekdi-technologies Date: Tue, 26 Nov 2024 16:09:28 +0530 Subject: [PATCH 1/3] Issue #0000 feat: Course planner bug fixes --- src/pages/resourceList.tsx | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/pages/resourceList.tsx b/src/pages/resourceList.tsx index 63386e92..6b7ec0c7 100644 --- a/src/pages/resourceList.tsx +++ b/src/pages/resourceList.tsx @@ -22,9 +22,10 @@ const ResourceList = () => { const resources = tstore.resources; const fetchedLearningResources = resources.learningResources || []; - - if (fetchedLearningResources?.length) { - let contents = await fetchBulkContents(fetchedLearningResources.map((item: any) => item.id)); + if (fetchedLearningResources?.length) { + let contents = await fetchBulkContents( + fetchedLearningResources.map((item: any) => item.id) + ); contents = contents.map((item: any) => { const contentType = fetchedLearningResources.find( @@ -33,9 +34,9 @@ const ResourceList = () => { return { ...item, - type: contentType - } - }) + type: contentType, + }; + }); console.log("contents", contents); const preRequisite = contents.filter( @@ -45,13 +46,13 @@ const ResourceList = () => { (item: any) => item.type === ResourceType.LEARNER_POST_REQUISITE ); const facilitatorsRequisite = contents.filter( - (item: any) => item.type === ResourceType.FACILITATOR_REQUISITE - ); - - setLearnersPreReq(preRequisite); - setLearnersPostReq(postRequisite); - setFacilitatorsPreReq(facilitatorsRequisite); - } + (item: any) => item.type === ResourceType.FACILITATOR_REQUISITE + ); + + setLearnersPreReq(preRequisite); + setLearnersPostReq(postRequisite); + setFacilitatorsPreReq(facilitatorsRequisite); + } }; fetchData(); From c1b009cb6f73ab6be393678cf43fd3dc706685db Mon Sep 17 00:00:00 2001 From: Arif-tekdi-technologies Date: Tue, 26 Nov 2024 16:42:11 +0530 Subject: [PATCH 2/3] Issue #0000 feat: Course planner bug fixes --- src/pages/resourceList.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/resourceList.tsx b/src/pages/resourceList.tsx index 6b7ec0c7..015cfdf1 100644 --- a/src/pages/resourceList.tsx +++ b/src/pages/resourceList.tsx @@ -20,17 +20,17 @@ const ResourceList = () => { useEffect(() => { const fetchData = async () => { const resources = tstore.resources; - const fetchedLearningResources = resources.learningResources || []; + const fetchedLearningResources = resources?.learningResources || []; if (fetchedLearningResources?.length) { let contents = await fetchBulkContents( - fetchedLearningResources.map((item: any) => item.id) + fetchedLearningResources?.map((item: any) => item.id) ); contents = contents.map((item: any) => { - const contentType = fetchedLearningResources.find( + const contentType = fetchedLearningResources?.find( (resource: any) => resource.id === item.identifier - ).type; + )?.type; return { ...item, From 8c50f0f74f465734f661b139078326f5995a40ec Mon Sep 17 00:00:00 2001 From: Arif-tekdi-technologies Date: Tue, 26 Nov 2024 17:44:30 +0530 Subject: [PATCH 3/3] Issue #0000 feat: Course planner bug fixes --- src/pages/subjectDetails.tsx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/pages/subjectDetails.tsx b/src/pages/subjectDetails.tsx index 1f856bf2..d0d734de 100644 --- a/src/pages/subjectDetails.tsx +++ b/src/pages/subjectDetails.tsx @@ -85,6 +85,15 @@ const SubjectDetails = () => { const setTaxonomyType = taxonomyStore((state) => state.setTaxonomyType); const setTaxonomySubject = taxonomyStore((state) => state.setTaxonomySubject); + useEffect(() => { + const savedMedium = localStorage.getItem("selectedMedium") || ""; + const savedGrade = localStorage.getItem("selectedGrade") || ""; + const savedType = localStorage.getItem("selectedType") || ""; + setSelectedmedium(savedMedium); + setSelectedgrade(savedGrade); + // setSelectedtype(savedType); + }, []); + useEffect(() => { const subjects = localStorage.getItem("overallCommonSubjects"); @@ -164,16 +173,6 @@ const SubjectDetails = () => { fetchFrameworkDetails(); }, [boardName]); - useEffect(() => { - const savedMedium = localStorage.getItem("selectedMedium") || ""; - const savedGrade = localStorage.getItem("selectedGrade") || ""; - const savedType = localStorage.getItem("selectedType") || ""; - - setSelectedmedium(savedMedium); - setSelectedgrade(savedGrade); - setSelectedtype(savedType); - }, []); - const fetchAndSetGradeData = (medium: any) => { const getGrades = getOptionsByCategory(store?.framedata, "gradeLevel"); const mediumAssociations = getAssociationsByCodeNew(mediumOptions, medium);