Skip to content

Commit 3b5e693

Browse files
committed
fix: ensure accurate tutor views
1 parent a76cecf commit 3b5e693

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/app/projects/states/dashboard/directives/task-dashboard/directives/task-status-card/task-status-card.component.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export class TaskStatusCardComponent implements OnChanges, AfterViewInit, OnDest
8686

8787
reapplyTriggers(): void {
8888
// if tutor is in queryParam
89-
if (this.route.snapshot.queryParamMap.has('tutor')) {
89+
if (this.isTutor) {
9090
this.triggers = this.taskService.statusKeys
9191
.map((k) => this.taskService.statusData(k))
9292
.filter((trigger) => {
@@ -162,10 +162,14 @@ export class TaskStatusCardComponent implements OnChanges, AfterViewInit, OnDest
162162

163163
public get currentUnitRole(): UnitRole | undefined {
164164
const currentUser = this.userService.currentUser;
165-
return this.project.unit.staff.find((ur) => ur.user.id === currentUser.id);
165+
return this.project?.unit?.staff.find((ur) => ur.user.id === currentUser.id);
166166
}
167167

168168
public get isTutor(): boolean {
169-
return this.currentUnitRole?.role === 'Convenor' || this.currentUnitRole?.role === 'Tutor';
169+
return (
170+
this.currentUnitRole?.role === 'Convenor' ||
171+
this.currentUnitRole?.role === 'Tutor' ||
172+
this.userService.currentUser.systemRole === 'Admin'
173+
);
170174
}
171175
}

src/app/projects/states/dashboard/directives/task-dashboard/task-dashboard.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class TaskDashboardComponent implements OnInit, OnChanges {
7171
) {}
7272

7373
ngOnInit(): void {
74-
this.tutor = this.route.snapshot.queryParamMap.has('tutor');
74+
this.tutor = this.currentUnitRole !== undefined;
7575
this.setSelectedDashboardView(DashboardViews.details);
7676
this.selectedTaskService.currentView$.subscribe((view) => {
7777
this.currentView = this.canAccessDashboardView(view) ? view : DashboardViews.details;

0 commit comments

Comments
 (0)