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: Fix an issue where the end page of exam does not scroll when the page is too small #8916

Merged
merged 2 commits into from
Jun 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
edkaya marked this conversation as resolved.
Show resolved Hide resolved
}
Loading