Skip to content

Commit

Permalink
Merge pull request #351 from Aar-if/seventy
Browse files Browse the repository at this point in the history
 Issue #0000 feat: Course planner bug fixes
  • Loading branch information
itsvick authored Nov 26, 2024
2 parents 3d153bd + 8c50f0f commit c509679
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
33 changes: 17 additions & 16 deletions src/pages/resourceList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,23 @@ 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));
if (fetchedLearningResources?.length) {
let contents = await fetchBulkContents(
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,
type: contentType
}
})
type: contentType,
};
});
console.log("contents", contents);

const preRequisite = contents.filter(
Expand All @@ -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();
Expand Down
19 changes: 9 additions & 10 deletions src/pages/subjectDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit c509679

Please sign in to comment.