Skip to content
Snippets Groups Projects
Commit d5e80804 authored by Lukas Mauß's avatar Lukas Mauß
Browse files

Fix current-content-group bug

parent 4eb4d4b6
Branches
Tags
No related merge requests found
......@@ -34,7 +34,10 @@ export class StatisticsPageComponent implements OnInit {
}
ngOnInit(): void {
this.currentCG = sessionStorage.getItem('contentGroup');
if (sessionStorage.getItem('contentGroup')) {
console.log('in if');
this.currentCG = sessionStorage.getItem('contentGroup');
}
this.getRoom(localStorage.getItem('roomId'));
this.tabGroup.selectedIndex = 1;
}
......@@ -44,9 +47,11 @@ export class StatisticsPageComponent implements OnInit {
this.roomService.getRoom(id).subscribe(room => {
this.contentGroups = room.contentGroups;
if (this.contentGroups) {
for (let i = 0; i < this.contentGroups.length; i++) {
if (this.currentCG.includes(this.contentGroups[i].name)) {
this.tabGroup.selectedIndex = i;
if( this.currentCG) {
for (let i = 0; i < this.contentGroups.length; i++) {
if (this.currentCG.includes(this.contentGroups[i].name)) {
this.tabGroup.selectedIndex = i;
}
}
}
} else {
......
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