diff --git a/src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.html b/src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.html index 6bad6dfcb843..f4c448b66930 100644 --- a/src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.html +++ b/src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.html @@ -11,7 +11,7 @@

@for (exercise of exercisesWithPlagiarismCases; track exercise; let i = $index) { -
+
diff --git a/src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.ts b/src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.ts index 760d8e6567fb..11eb5f641679 100644 --- a/src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.ts +++ b/src/main/webapp/app/course/plagiarism-cases/instructor-view/plagiarism-cases-instructor-view.component.ts @@ -1,5 +1,5 @@ import { HttpResponse } from '@angular/common/http'; -import { Component, OnInit } from '@angular/core'; +import { Component, ElementRef, OnInit, effect, viewChildren } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { PlagiarismCasesService } from 'app/course/plagiarism-cases/shared/plagiarism-cases.service'; import { PlagiarismCase } from 'app/exercises/shared/plagiarism/types/PlagiarismCase'; @@ -15,10 +15,13 @@ import { AlertService } from 'app/core/util/alert.service'; export class PlagiarismCasesInstructorViewComponent implements OnInit { courseId: number; examId?: number; + exerciseId?: number; plagiarismCases: PlagiarismCase[] = []; groupedPlagiarismCases: any; // maybe? { [key: number]: PlagiarismCase[] } exercisesWithPlagiarismCases: Exercise[] = []; + exerciseWithPlagCasesElements = viewChildren('plagExerciseElement'); + readonly getIcon = getIcon; readonly documentationType: DocumentationType = 'PlagiarismChecks'; @@ -26,11 +29,18 @@ export class PlagiarismCasesInstructorViewComponent implements OnInit { private plagiarismCasesService: PlagiarismCasesService, private route: ActivatedRoute, private alertService: AlertService, - ) {} + ) { + effect(() => { + if (this.exerciseId) { + this.scrollToExercise(); + } + }); + } ngOnInit(): void { this.courseId = Number(this.route.snapshot.paramMap.get('courseId')); this.examId = Number(this.route.snapshot.paramMap.get('examId')); + this.exerciseId = Number(this.route.snapshot.queryParamMap?.get('exerciseId')); const plagiarismCasesForInstructor$ = this.examId ? this.plagiarismCasesService.getExamPlagiarismCasesForInstructor(this.courseId, this.examId) @@ -68,6 +78,17 @@ export class PlagiarismCasesInstructorViewComponent implements OnInit { }); } + scrollToExercise() { + const element = this.exerciseWithPlagCasesElements().find((elem) => elem.nativeElement.id === 'exercise-with-plagiarism-case-' + this.exerciseId); + if (element) { + element.nativeElement.scrollIntoView({ + behavior: 'smooth', + block: 'start', + inline: 'nearest', + }); + } + } + /** * calculate the total number of plagiarism cases * @param plagiarismCases plagiarismCases in the course or exam diff --git a/src/main/webapp/app/exercises/shared/plagiarism/plagiarism-header/plagiarism-header.component.html b/src/main/webapp/app/exercises/shared/plagiarism/plagiarism-header/plagiarism-header.component.html index aff14deb4db6..1fc2c3ac1157 100644 --- a/src/main/webapp/app/exercises/shared/plagiarism/plagiarism-header/plagiarism-header.component.html +++ b/src/main/webapp/app/exercises/shared/plagiarism/plagiarism-header/plagiarism-header.component.html @@ -7,13 +7,17 @@
- + @if (comparison.status !== plagiarismStatus.CONFIRMED && !isLoading && !exercise.teamMode) { + + } @else { + + }