diff --git a/public/Sample.csv b/public/Sample.csv
index fd37d57b..9e2a4a2a 100644
--- a/public/Sample.csv
+++ b/public/Sample.csv
@@ -1,10 +1,5 @@
-name,externalId,description,type,hasAParentTask,parentTaskOperator,parentTaskValue,parentTaskId,isDeletable,learningResources1-name,learningResources1-link,learningResources1-app,learningResources1-type,learningResources1-id,learningResources2-name,learningResources2-link,learningResources2-app,learningResources2-type,minNoOfSubmissionsRequired,sequenceNumber,startDate,endDate,solutionType,solutionSubType,solutionId
-Maths-Chapter 1,1,,content,NO,,,,FALSE,,,,,,,,,,,1,09-01-2024,10/31/24,,,
-Arithmetic,2,,content,YES,EQUALS,started,1,FALSE,Chemical reaction,https://www.youtube.com/watch?v=TStjgUmL1RQ,Youtube,postrequisite,,,https://www.youtube.com/watch?v=CqN-XIPhMpo,,,subTask1,2,09-01-2024,10/31/24,,,
-Polynomials,3,,content,YES,EQUALS,started,1,FALSE,Acid and Base,https://www.youtube.com/watch?v=ja7p_tzTTEA,Youtube,postrequisite,,,https://www.youtube.com/watch?v=rDjWrNRKfvg,,,subTask1,4,09-01-2024,10/31/24,,,
-Coordinate geometry,4,,content,YES,EQUALS,started,1,FALSE,Equation of Motion,https://www.youtube.com/watch?v=80gApHJd3iY,Youtube,prerequisite,,,,,,subTask1,3,09-01-2024,10/31/24,,,
-Maths-Chapter 2,5,,content,NO,,,,FALSE,,,,,,,,,,,5,09-01-2024,10/31/24,,,
-Circles,6,,content,YES,EQUALS,started,5,FALSE,Human Organs,https://www.youtube.com/watch?v=YE2peDF4Zqg,Youtube,prerequisite,,,,,,subTask1,6,09-01-2024,10/31/24,,,
-Trigonometry,7,,content,YES,EQUALS,started,5,FALSE,CardioVascular,https://www.youtube.com/watch?v=Vi1JK6IYVt8,Youtube,prerequisite,,,,,,subTask1,7,09-01-2024,10/31/24,,,
-Statistics,8,,content,YES,EQUALS,started,5,FALSE,Liver and Kidney,https://www.youtube.com/watch?v=rDjWrNRKfvg,Youtube,postrequisite,,,,,,subTask1,8,09-01-2024,10/31/24,,,
-Quadratic Equation,9,,content,YES,EQUALS,started,5,FALSE,Kaade Kess Resource,https://www.youtube.com/watch?v=CqN-XIPhMpo,Youtube,postrequisite,,,https://www.youtube.com/watch?v=CqN-XIPhMpo,,,subTask1,9,09-01-2024,10/31/24,,,
\ No newline at end of file
+name,externalId,type,hasAParentTask,parentTaskId,learningResources1-name,learningResources1-type,learningResources1-id,learningResources2-name,learningResources2-type,learningResources2-id,startDate,endDate
+Chapter 1: Real Numbers Clas 6,1,content,,,,,,,,,10-02-2025,11-02-2025
+Introduction to Real Numbers,2,content,YES,1,Real Numbers – Video,prerequisite,do_2141830551647928321130,Real Numbers – Assessment,postrequisite,do_2141829595245281281142,07-02-2025,11-02-2025
+Euclid’s Division Lemma,3,content,YES,1,Euclids Formula – Youtube,prerequisite,do_2141830572373852161134,Euclids Formula – EPUB,postrequisite,do_2141830562205204481132,10-02-2025,11-02-2025
+The Fundamental Theorem of Arithmetic,4,content,YES,1,Fundamental Therom – PDF,facilitator-requisite,do_2141830485434695681127,,facilitator-requisite,,10-02-2025,11-02-2025
diff --git a/src/pages/stateDetails.tsx b/src/pages/stateDetails.tsx
index f4ddf9f5..9bd95e9b 100644
--- a/src/pages/stateDetails.tsx
+++ b/src/pages/stateDetails.tsx
@@ -82,6 +82,9 @@ const StateDetails = () => {
const handleBoardClick = (board: string, boardName: string) => {
setBoard(boardName);
+ localStorage.removeItem("selectedGrade");
+ localStorage.removeItem("selectedMedium");
+ localStorage.removeItem("selectedType");
router.push({
pathname: "/subjectDetails",
query: { boardDetails: board, boardName: boardName },
diff --git a/src/pages/subjectDetails.tsx b/src/pages/subjectDetails.tsx
index c8199003..1f856bf2 100644
--- a/src/pages/subjectDetails.tsx
+++ b/src/pages/subjectDetails.tsx
@@ -31,6 +31,7 @@ import {
} from "@/utils/Helper";
import { TelemetryEventType } from "@/utils/app.constant";
import { telemetryFactory } from "@/utils/telemetry";
+import theme from "@/components/theme/theme";
// Define Card interface
interface Card {
@@ -261,6 +262,88 @@ const SubjectDetails = () => {
setType(commonType3Data);
};
+ const fetchAndSetSubData = (type: any) => {
+ const typeAssociations = getAssociationsByCodeNew(typeOptions, type);
+ setTypeAssociations(typeAssociations);
+ const subject = getOptionsByCategory(store?.framedata, "subject");
+
+ console.log(subject);
+
+ const commonTypeInState = filterAndMapAssociations(
+ "subject",
+ subject,
+ store?.stateassociations,
+ "code"
+ );
+ const commonTypeInBoard = filterAndMapAssociations(
+ "subject",
+ type,
+ boardAssociations,
+ "code"
+ );
+ const commonTypeInMedium = filterAndMapAssociations(
+ "subject",
+ subject,
+ mediumAssociations,
+ "code"
+ );
+ const commonTypeInGrade = filterAndMapAssociations(
+ "subject",
+ subject,
+ gradeAssociations,
+ "code"
+ );
+ const commonTypeInType = filterAndMapAssociations(
+ "subject",
+ subject,
+ typeAssociations,
+ "code"
+ );
+
+ const findCommonAssociations = (array1: any[], array2: any[]) => {
+ return array1.filter((item1: { code: any }) =>
+ array2.some((item2: { code: any }) => item1.code === item2.code)
+ );
+ };
+
+ const findOverallCommonSubjects = (arrays: any[]) => {
+ const nonEmptyArrays = arrays.filter(
+ (array: string | any[]) => array && array.length > 0
+ );
+
+ if (nonEmptyArrays.length === 0) return [];
+
+ let commonSubjects = nonEmptyArrays[0];
+
+ for (let i = 1; i < nonEmptyArrays.length; i++) {
+ commonSubjects = findCommonAssociations(
+ commonSubjects,
+ nonEmptyArrays[i]
+ );
+
+ if (commonSubjects.length === 0) return [];
+ }
+
+ return commonSubjects;
+ };
+
+ const arrays = [
+ commonTypeInState,
+ commonTypeInBoard,
+ commonTypeInMedium,
+ commonTypeInGrade,
+ commonTypeInType,
+ ];
+
+ const overallCommonSubjects = findOverallCommonSubjects(arrays);
+
+ setSubject(overallCommonSubjects);
+ localStorage.setItem(
+ "overallCommonSubjects",
+ JSON.stringify(overallCommonSubjects)
+ );
+ };
+
useEffect(() => {
if (selectedmedium) {
fetchAndSetGradeData(selectedmedium);
@@ -273,17 +356,20 @@ const SubjectDetails = () => {
}
}, [selectedgrade]);
- // useEffect(() => {
- // if (selectedtype) {
- // fetchAndSetSubData(selectedtype);
- // }
- // }, [selectedtype]);
+ useEffect(() => {
+ if (selectedtype) {
+ fetchAndSetSubData(selectedtype);
+ }
+ }, [selectedtype]);
if (loading) {
return ;
}
const handleBackClick = () => {
+ localStorage.removeItem("selectedGrade");
+ localStorage.removeItem("selectedMedium");
+ localStorage.removeItem("selectedType");
router.back();
};
@@ -301,9 +387,9 @@ const SubjectDetails = () => {
const medium = event.target.value;
setSelectedmedium(medium);
setTaxonomyMedium(medium);
- setSelectedgrade([null]);
- setSelectedtype([null]);
- setSubject([null]);
+ // setSelectedgrade([null]);
+ // setSelectedtype([null]);
+ // setSubject([null]);
const windowUrl = window.location.pathname;
const cleanedUrl = windowUrl.replace(/^\//, "");
@@ -357,87 +443,6 @@ const SubjectDetails = () => {
setTaxonomyType(type);
setSelectedtype(type);
- if (type) {
- const typeAssociations = getAssociationsByCodeNew(typeOptions, type);
- setTypeAssociations(typeAssociations);
- const subject = getOptionsByCategory(store?.framedata, "subject");
-
- console.log(subject);
-
- const commonTypeInState = filterAndMapAssociations(
- "subject",
- subject,
- store?.stateassociations,
- "code"
- );
- const commonTypeInBoard = filterAndMapAssociations(
- "subject",
- type,
- boardAssociations,
- "code"
- );
- const commonTypeInMedium = filterAndMapAssociations(
- "subject",
- subject,
- mediumAssociations,
- "code"
- );
- const commonTypeInGrade = filterAndMapAssociations(
- "subject",
- subject,
- gradeAssociations,
- "code"
- );
- const commonTypeInType = filterAndMapAssociations(
- "subject",
- subject,
- typeAssociations,
- "code"
- );
-
- const findCommonAssociations = (array1: any[], array2: any[]) => {
- return array1.filter((item1: { code: any }) =>
- array2.some((item2: { code: any }) => item1.code === item2.code)
- );
- };
-
- const findOverallCommonSubjects = (arrays: any[]) => {
- const nonEmptyArrays = arrays.filter(
- (array: string | any[]) => array && array.length > 0
- );
-
- if (nonEmptyArrays.length === 0) return [];
-
- let commonSubjects = nonEmptyArrays[0];
-
- for (let i = 1; i < nonEmptyArrays.length; i++) {
- commonSubjects = findCommonAssociations(
- commonSubjects,
- nonEmptyArrays[i]
- );
-
- if (commonSubjects.length === 0) return [];
- }
-
- return commonSubjects;
- };
-
- const arrays = [
- commonTypeInState,
- commonTypeInBoard,
- commonTypeInMedium,
- commonTypeInGrade,
- commonTypeInType,
- ];
-
- const overallCommonSubjects = findOverallCommonSubjects(arrays);
-
- setSubject(overallCommonSubjects);
- localStorage.setItem(
- "overallCommonSubjects",
- JSON.stringify(overallCommonSubjects)
- );
- }
const windowUrl = window.location.pathname;
const cleanedUrl = windowUrl.replace(/^\//, "");
const env = cleanedUrl.split("/")[0];
@@ -458,6 +463,13 @@ const SubjectDetails = () => {
telemetryFactory.interact(telemetryInteract);
};
+ const handleReset = () => {
+ setSelectedmedium("");
+ setSelectedgrade("");
+ setSelectedtype("");
+ setSubject("");
+ };
+
return (
@@ -554,6 +566,24 @@ const SubjectDetails = () => {
))}
+
+
+