Skip to content

Commit

Permalink
Exam mode: Fix an issue where the end page of exam does not scroll wh…
Browse files Browse the repository at this point in the history
…en the page is too small (#8916)
  • Loading branch information
edkaya authored Jun 30, 2024
1 parent 14d7a89 commit 8e9567a
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,11 @@ export class ExamParticipationCoverComponent implements OnChanges, OnDestroy, On
this.testExam = this.exam.testExam;

if (this.startView) {
this.examParticipationService.setEndView(false);
this.formattedGeneralInformation = this.artemisMarkdown.safeHtmlForMarkdown(this.exam.startText);
this.formattedConfirmationText = this.artemisMarkdown.safeHtmlForMarkdown(this.exam.confirmationStartText);
} else {
this.examParticipationService.setEndView(true);
this.formattedGeneralInformation = this.artemisMarkdown.safeHtmlForMarkdown(this.exam.endText);
this.formattedConfirmationText = this.artemisMarkdown.safeHtmlForMarkdown(this.exam.confirmationEndText);
// this should be the individual working end + the grace period
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export class ExamParticipationService {
private testRunSubject = new BehaviorSubject<boolean>(false);
testRunStarted$ = this.testRunSubject.asObservable();

private examEndViewSubject = new BehaviorSubject<boolean>(false);
endViewDisplayed$ = this.examEndViewSubject.asObservable();

private examExerciseIds: number[];

public getResourceURL(courseId: number, examId: number): string {
Expand Down Expand Up @@ -351,6 +354,10 @@ export class ExamParticipationService {
this.examExerciseIds = examExerciseIds;
}

setEndView(isEndView: boolean) {
this.examEndViewSubject.next(isEndView);
}

setExamLayout(isExamStarted: boolean = true, isTestRun: boolean = false) {
this.examIsStartedSubject.next(isExamStarted);
this.testRunSubject.next(isTestRun);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
'exam-wrapper': isExamStarted,
'exam-height-dev': isExamStarted && (!isProduction || isTestServer),
'sidenav-height-dev': !isProduction || isTestServer,
'exam-end-view': isExamEndView,
}"
>
<div class="dropdown-content" [hidden]="!dropdownOpen" [style.top.px]="dropdownOffset" [ngClass]="{ fixedContentSize: hiddenItems.length >= 3 }">
Expand Down
4 changes: 4 additions & 0 deletions src/main/webapp/app/overview/course-overview.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ $breadcrumb-height: 45px; // needed to make the exam fullscreen
}
}

.exam-end-view {
overflow-y: auto !important;
}

a:not(.btn):not(.tab-link):hover {
text-decoration: none !important;
}
Expand Down
6 changes: 6 additions & 0 deletions src/main/webapp/app/overview/course-overview.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ export class CourseOverviewComponent implements OnInit, OnDestroy, AfterViewInit
profileSubscription?: Subscription;
showRefreshButton: boolean = false;
isExamStarted = false;
isExamEndView = false;
private examStartedSubscription: Subscription;
private examEndViewSubscription: Subscription;
readonly MIN_DISPLAYED_COURSES: number = 6;

// Properties to track hidden items for dropdown menu
Expand Down Expand Up @@ -207,6 +209,9 @@ export class CourseOverviewComponent implements OnInit, OnDestroy, AfterViewInit
this.examStartedSubscription = this.examParticipationService.examIsStarted$.subscribe((isStarted) => {
this.isExamStarted = isStarted;
});
this.examEndViewSubscription = this.examParticipationService.endViewDisplayed$.subscribe((isEndView) => {
this.isExamEndView = isEndView;
});
this.getCollapseStateFromStorage();
this.course = this.courseStorageService.getCourse(this.courseId);
this.isNotManagementView = !this.router.url.startsWith('/course-management');
Expand Down Expand Up @@ -757,6 +762,7 @@ export class CourseOverviewComponent implements OnInit, OnDestroy, AfterViewInit
this.subscription?.unsubscribe();
this.profileSubscription?.unsubscribe();
this.examStartedSubscription?.unsubscribe();
this.examEndViewSubscription?.unsubscribe();
this.dashboardSubscription?.unsubscribe();
this.ngUnsubscribe.next();
this.ngUnsubscribe.complete();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const exercises = [exercise];
studentExamInstance.exercises = exercises as Exercise[];

const examParticipationSubjectMock = new BehaviorSubject<StudentExam>(studentExamInstance);
const examEndViewSubject = new BehaviorSubject<boolean>(false);

export class MockExamParticipationService {
loadStudentExam = (courseId: number, examId: number): Observable<StudentExam> => {
Expand Down Expand Up @@ -40,4 +41,8 @@ export class MockExamParticipationService {
public getOwnStudentExam(courseId: number, examId: number): Observable<StudentExam> {
return of({} as StudentExam);
}

setEndView(isEndView: boolean): void {
examEndViewSubject.next(false);
}
}

0 comments on commit 8e9567a

Please sign in to comment.