Commit fb01e234 authored by Anusha Mamidala's avatar Anusha Mamidala
Browse files

Added electron and filters

parent 0231ce3a
......@@ -8,7 +8,7 @@ import { Course } from 'src/app/shared/course';
styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {
selectedClass = 4;
selectedClass = "";
selectedSubject = 'all';
selectedOption: any;
simulationItems: Course[];
......@@ -21,16 +21,32 @@ export class HomeComponent implements OnInit {
this.simulationItems = response;
})
}
filterSubjectsClasses(): Course[] {
let items = [...this.simulationItems];
if (this.selectedOption?.selectedClass != "" && this.selectedOption?.selectedSubject === 'all') {
let filteredItems = items.filter(e =>
e.class.includes(parseInt(this.selectedOption?.selectedClass))
);
return filteredItems;
}
else if (this.selectedOption?.selectedClass === "" && this.selectedOption?.selectedSubject !== 'all') {
return items.filter(e => e.category === this.selectedOption?.selectedSubject
)
}
else {
return items.filter(e => (e.category === this.selectedOption?.selectedSubject) && (e.class.includes(parseInt(this.selectedOption?.selectedClass)))
)
}
}
getCourses() {
this.selectedOption = {
"selectedClass": this.selectedClass,
"selectedSubject": this.selectedSubject
}
if (this.selectedOption?.selectedSubject !== 'all') {
console.log('here', this.selectedOption?.selectedSubject);
this.simulationItems = this.simulationItems.filter(e => e.category === this.selectedOption?.selectedSubject);
}
this.simulationItems = this.filterSubjectsClasses();
console.log(this.simulationItems);
}
onSelectClass(value) {
......
......@@ -12,7 +12,7 @@
"category": "bio",
"name": "Biology Simulation",
"img_src": "bio.jpg",
"url": "atomic-interactions_en",
"url": "balancing-act_en",
"class": [6,7]
},
{
......
......@@ -22,7 +22,7 @@ const createWindow = () => {
slashes: true,
})
);
win.webContents.openDevTools();
//win.webContents.openDevTools();
// Emitted when the window is closed.
win.on("closed", () => {
// Dereference the window object, usually you would store windows
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment