Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exam mode: Show number of accepted complaints in assessment dashboard #7144

Merged
merged 8 commits into from
Oct 3, 2023
7 changes: 4 additions & 3 deletions src/main/webapp/app/core/auth/account.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { JhiWebsocketService } from 'app/core/websocket/websocket.service';
import { FeatureToggleService } from 'app/shared/feature-toggle/feature-toggle.service';
import { setUser } from '@sentry/angular-ivy';
import { StudentParticipation } from 'app/entities/participation/student-participation.model';
import { Exercise } from 'app/entities/exercise.model';
import { Exercise, getCourseFromExercise } from 'app/entities/exercise.model';
import { Authority } from 'app/shared/constants/authority.constants';
import { TranslateService } from '@ngx-translate/core';

Expand Down Expand Up @@ -238,8 +238,9 @@ export class AccountService implements IAccountService {

setAccessRightsForExerciseAndReferencedCourse(exercise: Exercise) {
this.setAccessRightsForExercise(exercise);
if (exercise.course) {
this.setAccessRightsForCourse(exercise.course);
const course = getCourseFromExercise(exercise);
if (course) {
this.setAccessRightsForCourse(course);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,12 @@
</ng-container>

<ng-container *ngIf="!isExerciseDashboard && course && course.id">
<td>
<td *ngIf="isExamMode && exam">
valentin-boehm marked this conversation as resolved.
Show resolved Hide resolved
<a [routerLink]="['/course-management', course.id, 'exams', exam.id, 'complaints']" [queryParams]="{ tutorId: tutor.userId }">
{{ tutor.numberOfAcceptedComplaints }}
</a>
</td>
<td *ngIf="!isExamMode">
<a [routerLink]="['/course-management', course.id, 'complaints']" [queryParams]="{ tutorId: tutor.userId }">
{{ tutor.numberOfAcceptedComplaints }}
</a>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, Input, OnInit } from '@angular/core';
import { TutorLeaderboardElement } from 'app/shared/dashboards/tutor-leaderboard/tutor-leaderboard.model';
import { Course } from 'app/entities/course.model';
import { Exercise } from 'app/entities/exercise.model';
import { Exercise, getCourseFromExercise } from 'app/entities/exercise.model';
import { AccountService } from 'app/core/auth/account.service';
import { SortService } from 'app/shared/service/sort.service';
import { Exam } from 'app/entities/exam.model';
Expand Down Expand Up @@ -35,10 +35,10 @@ export class TutorLeaderboardComponent implements OnInit {
* Life cycle hook called by Angular to indicate that Angular is done creating the component
*/
ngOnInit(): void {
if (this.exercise && this.exercise.course) {
this.course = this.exercise.course;
this.isExerciseDashboard = true;
if (this.exercise) {
this.course = getCourseFromExercise(this.exercise);
}
this.isExerciseDashboard = !!(this.exercise && this.course);
this.isExamMode = !!this.exam;
this.sortRows();
}
Expand Down
Loading