From fb4a2ce527508fd64fe2fc6e89c10cc521234151 Mon Sep 17 00:00:00 2001 From: JackSCarroll <64730336+JackSCarroll@users.noreply.github.com> Date: Tue, 20 Aug 2024 14:27:51 +1000 Subject: [PATCH 1/6] refactor: add button on frontend for future jplag report viewer --- src/app/common/footer/footer.component.html | 4 ++++ src/app/common/footer/footer.component.ts | 4 ++++ src/app/projects/states/dashboard/selected-task.service.ts | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/src/app/common/footer/footer.component.html b/src/app/common/footer/footer.component.html index 7e28c72b3..d34e3c265 100644 --- a/src/app/common/footer/footer.component.html +++ b/src/app/common/footer/footer.component.html @@ -108,6 +108,10 @@ crisis_alert View similarities + - - } @if (!isTaskDefMode) { - - } @if (isTaskDefMode) { - + + } + @if (!isTaskDefMode) { + + } + @if (isTaskDefMode) { + } + @@ -93,16 +102,20 @@ name="taskDefID" (selectionChange)="taskDefinitionIdChanged()" > - All Task Definitions + All Task Definitions @for (td of unit.taskDefinitionCache.values | async; track td) { - - {{ td.abbreviation + ' - ' + td.name }} - + + {{ td.abbreviation + ' - ' + td.name }} + } @@ -140,14 +158,19 @@ - +
-
+
@if (!isNarrow) { -
- -
+
+ +
}
@@ -170,44 +195,45 @@ @if (filteredTasks) { - - - - @if (task) { -
+ + -
- - -
-

{{ task.project.student.name }}

-
- {{ task.definition.abbreviation }} - - {{ task.definition.name }} -
- -
- @if (task.hasGrade()) { -
- {{ task.gradeDesc() }} -
- } - - @if (!isTaskDefMode) { -
- - - - - + + @if (!isTaskDefMode) { +
+ + + + + +
+ } +
+
- } -
- -
- } - + } + - - - + + + }
diff --git a/src/app/units/states/tasks/inbox/directives/staff-task-list/staff-task-list.component.ts b/src/app/units/states/tasks/inbox/directives/staff-task-list/staff-task-list.component.ts index 95b498af2..a6d26643c 100644 --- a/src/app/units/states/tasks/inbox/directives/staff-task-list/staff-task-list.component.ts +++ b/src/app/units/states/tasks/inbox/directives/staff-task-list/staff-task-list.component.ts @@ -226,6 +226,18 @@ export class StaffTaskListComponent implements OnInit, OnChanges, OnDestroy { ); } + downloadJPLAGReport() { + const taskDef = this.filters.taskDefinition; + this.fileDownloaderService.downloadFile( + //this.taskData.selectedTask.jplagReportUrl() + `${AppInjector.get(DoubtfireConstants).API_URL}/units/${ + this.unit.id + }/task_definitions/${taskDef.id}/jplag_report`, + `${this.unit.code}-${taskDef.abbreviation}-jplag-report.zip`, + ); + window.open('https://jplag.github.io/JPlag/', '_blank'); + } + openDialog() { const dialogRef = this.dialog.open(this.searchDialog); From 1ef531644cf34957640c8c002a7bf4655b4f505d Mon Sep 17 00:00:00 2001 From: JackSCarroll <64730336+JackSCarroll@users.noreply.github.com> Date: Tue, 24 Sep 2024 22:02:46 +1000 Subject: [PATCH 4/6] chore: commit edited files --- src/app/common/footer/footer.component.html | 4 ---- src/app/common/footer/footer.component.ts | 1 - .../states/dashboard/selected-task.service.ts | 5 ----- .../task-definition-upload.component.html | 2 ++ .../staff-task-list.component.html | 6 +++++- .../staff-task-list/staff-task-list.component.ts | 15 +++++++++++++++ 6 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/app/common/footer/footer.component.html b/src/app/common/footer/footer.component.html index 9d595ac33..7e28c72b3 100644 --- a/src/app/common/footer/footer.component.html +++ b/src/app/common/footer/footer.component.html @@ -108,10 +108,6 @@ crisis_alert View similarities - - diff --git a/src/app/units/states/tasks/inbox/directives/staff-task-list/staff-task-list.component.ts b/src/app/units/states/tasks/inbox/directives/staff-task-list/staff-task-list.component.ts index a6d26643c..12e114871 100644 --- a/src/app/units/states/tasks/inbox/directives/staff-task-list/staff-task-list.component.ts +++ b/src/app/units/states/tasks/inbox/directives/staff-task-list/staff-task-list.component.ts @@ -206,6 +206,21 @@ export class StaffTaskListComponent implements OnInit, OnChanges, OnDestroy { return this.taskData.taskDefMode; } + // public get taskHasJplagReport(): boolean { + // console.log('taskHasSimilarityChecks getter called'); + // if (!this.selectedTask.hasSimilarity()) { + // console.error('filters.taskDefinition is not defined'); + // return false; + // } + // if (typeof this.filters.taskDefinition.hasPlagiarismCheck !== 'function') { + // console.error('hasPlagiarismCheck is not a function'); + // return false; + // } + // const result = this.filters.taskDefinition.hasPlagiarismCheck(); + // console.log('taskHasSimilarityChecks result:', result); + // return result; + // } + downloadSubmissionPdfs() { const taskDef = this.filters.taskDefinition; this.fileDownloaderService.downloadFile( From 8549817a48f46f81ffc7918c194d815870ac080a Mon Sep 17 00:00:00 2001 From: JackSCarroll <64730336+JackSCarroll@users.noreply.github.com> Date: Fri, 11 Oct 2024 19:48:40 +1100 Subject: [PATCH 5/6] refactor: add features for jplag report download --- src/app/api/models/task-definition.ts | 4 +-- src/app/api/models/task-similarity.ts | 6 ++--- .../api/services/task-definition.service.ts | 2 +- .../task-similarity-view.component.html | 27 +++++++++++++------ .../task-similarity-view.component.ts | 18 ++++++++++++- .../task-definition-upload.component.html | 20 +++++++------- 6 files changed, 51 insertions(+), 26 deletions(-) diff --git a/src/app/api/models/task-definition.ts b/src/app/api/models/task-definition.ts index 1b49a2e85..48ce4699f 100644 --- a/src/app/api/models/task-definition.ts +++ b/src/app/api/models/task-definition.ts @@ -36,7 +36,7 @@ export class TaskDefinition extends Entity { maxQualityPts: number; overseerImageId: number; assessmentEnabled: boolean; - mossLanguage: string = 'moss c'; + jplagLanguage: string = 'c'; readonly unit: Unit; @@ -160,7 +160,7 @@ export class TaskDefinition extends Entity { return this.plagiarismChecks?.length > 0; } - public get needsMoss(): boolean { + public get needsJplag(): boolean { return this.uploadRequirements.some((upreq) => upreq.type === 'code' && upreq.tiiCheck); } diff --git a/src/app/api/models/task-similarity.ts b/src/app/api/models/task-similarity.ts index c3a72e556..be8b3d9b0 100644 --- a/src/app/api/models/task-similarity.ts +++ b/src/app/api/models/task-similarity.ts @@ -5,7 +5,7 @@ import { DoubtfireConstants } from 'src/app/config/constants/doubtfire-constants import { Observable } from 'rxjs'; export enum TaskSimilarityType { - Moss = 'MossTaskSimilarity', + Jplag = 'JplagTaskSimilarity', TurnItIn = 'TiiTaskSimilarity', } @@ -62,8 +62,8 @@ export class TaskSimilarity extends Entity { public get friendlyTypeName(): string { switch (this.type) { - case TaskSimilarityType.Moss: - return 'MOSS'; + case TaskSimilarityType.Jplag: + return 'JPLAG'; case TaskSimilarityType.TurnItIn: return 'TurnItIn'; } diff --git a/src/app/api/services/task-definition.service.ts b/src/app/api/services/task-definition.service.ts index 13a1dd279..e0b685c20 100644 --- a/src/app/api/services/task-definition.service.ts +++ b/src/app/api/services/task-definition.service.ts @@ -21,7 +21,7 @@ export class TaskDefinitionService extends CachedEntityService { 'description', 'weighting', 'targetGrade', - 'mossLanguage', + 'jplagLanguage', { keys: 'targetDate', toEntityFn: MappingFunctions.mapDateToEndOfDay, diff --git a/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-similarity-view/task-similarity-view.component.html b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-similarity-view/task-similarity-view.component.html index f068cb609..2f42a7974 100644 --- a/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-similarity-view/task-similarity-view.component.html +++ b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-similarity-view/task-similarity-view.component.html @@ -23,14 +23,25 @@

{{ part.description }} @if (similarity.readyForViewer) { - + @if (similarity.type === 'JplagTaskSimilarity') { + + } @else { + + } } @if (i === 0) { -
diff --git a/src/app/units/states/tasks/inbox/directives/staff-task-list/staff-task-list.component.ts b/src/app/units/states/tasks/inbox/directives/staff-task-list/staff-task-list.component.ts index 12e114871..2b2c03286 100644 --- a/src/app/units/states/tasks/inbox/directives/staff-task-list/staff-task-list.component.ts +++ b/src/app/units/states/tasks/inbox/directives/staff-task-list/staff-task-list.component.ts @@ -77,6 +77,8 @@ export class StaffTaskListComponent implements OnInit, OnChanges, OnDestroy { tasks: any[] = null; + hasJplagReport: boolean; + watchingTaskKey: any; panelOpenState = false; @@ -206,20 +208,19 @@ export class StaffTaskListComponent implements OnInit, OnChanges, OnDestroy { return this.taskData.taskDefMode; } - // public get taskHasJplagReport(): boolean { - // console.log('taskHasSimilarityChecks getter called'); - // if (!this.selectedTask.hasSimilarity()) { - // console.error('filters.taskDefinition is not defined'); - // return false; - // } - // if (typeof this.filters.taskDefinition.hasPlagiarismCheck !== 'function') { - // console.error('hasPlagiarismCheck is not a function'); - // return false; - // } - // const result = this.filters.taskDefinition.hasPlagiarismCheck(); - // console.log('taskHasSimilarityChecks result:', result); - // return result; - // } + // TODO: Get this to return correct value from the API + public async taskHasJplagReport(): Promise { + const taskDef = this.filters.taskDefinition; + return taskDef + .hasJplagReport() + .then((hasReport) => { + return hasReport ?? false; + }) + .catch((error) => { + console.error(error); + return false; + }); + } downloadSubmissionPdfs() { const taskDef = this.filters.taskDefinition; @@ -376,6 +377,10 @@ export class StaffTaskListComponent implements OnInit, OnChanges, OnDestroy { this.alertService.error(message, 6000); }, }); + this.taskHasJplagReport().then((hasReport) => { + this.hasJplagReport = hasReport; + }); + console.log('HAS JPLAG REPORT:', this.hasJplagReport); } setSelectedTask(task: Task) {