From e0e62260690cc2e5297cbbf9292d30e0c5bce452 Mon Sep 17 00:00:00 2001 From: Hiroki Terashima Date: Wed, 18 Sep 2024 17:40:51 -0700 Subject: [PATCH] refactor(Notebook): Remove unused NotebookReportAnnotationComponent (#1947) --- ...notebook-report-annotations.component.html | 36 ------- ...ebook-report-annotations.component.spec.ts | 35 ------- .../notebook-report-annotations.component.ts | 97 ------------------- .../notebook-report.component.html | 13 +-- src/app/notebook/notebook.module.ts | 10 +- src/messages.xlf | 49 +++------- 6 files changed, 19 insertions(+), 221 deletions(-) delete mode 100644 src/app/notebook/notebook-report-annotations/notebook-report-annotations.component.html delete mode 100644 src/app/notebook/notebook-report-annotations/notebook-report-annotations.component.spec.ts delete mode 100644 src/app/notebook/notebook-report-annotations/notebook-report-annotations.component.ts diff --git a/src/app/notebook/notebook-report-annotations/notebook-report-annotations.component.html b/src/app/notebook/notebook-report-annotations/notebook-report-annotations.component.html deleted file mode 100644 index 335cf74cf82..00000000000 --- a/src/app/notebook/notebook-report-annotations/notebook-report-annotations.component.html +++ /dev/null @@ -1,36 +0,0 @@ -
- - -
- {{ icon }} -
-
- {{ label }} - - -
-
- -
-
-
-
-
- - Score: {{ annotations.score.data.value }}{{ maxScoreDisplay }} - - - - - - -
-
-
-
diff --git a/src/app/notebook/notebook-report-annotations/notebook-report-annotations.component.spec.ts b/src/app/notebook/notebook-report-annotations/notebook-report-annotations.component.spec.ts deleted file mode 100644 index 1b017c08f22..00000000000 --- a/src/app/notebook/notebook-report-annotations/notebook-report-annotations.component.spec.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { provideHttpClientTesting } from '@angular/common/http/testing'; -import { TestBed } from '@angular/core/testing'; -import { StudentTeacherCommonServicesModule } from '../../student-teacher-common-services.module'; -import { NotebookReportAnnotationsComponent } from './notebook-report-annotations.component'; -import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; - -let component: NotebookReportAnnotationsComponent; - -describe('NotebookReportAnnotationsComponent', () => { - beforeEach(() => { - TestBed.configureTestingModule({ - declarations: [NotebookReportAnnotationsComponent], - imports: [StudentTeacherCommonServicesModule], - providers: [provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()] -}); - const fixture = TestBed.createComponent(NotebookReportAnnotationsComponent); - component = fixture.componentInstance; - }); - - setLabelAndIcon(); -}); - -function setLabelAndIcon() { - it('should set label and icon', () => { - const annotation = { - type: 'autoComment' - }; - spyOn(component, 'getLatestAnnotation').and.returnValue(annotation); - expect(component.label).toEqual(''); - expect(component.icon).toEqual('person'); - component.setLabelAndIcon(); - expect(component.label).toEqual('Computer Feedback'); - expect(component.icon).toEqual('keyboard'); - }); -} diff --git a/src/app/notebook/notebook-report-annotations/notebook-report-annotations.component.ts b/src/app/notebook/notebook-report-annotations/notebook-report-annotations.component.ts deleted file mode 100644 index 985193bdf5f..00000000000 --- a/src/app/notebook/notebook-report-annotations/notebook-report-annotations.component.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { Component, Input } from '@angular/core'; -import { ConfigService } from '../../../assets/wise5/services/configService'; -import { VLEProjectService } from '../../../assets/wise5/vle/vleProjectService'; - -@Component({ - selector: 'notebook-report-annotations', - templateUrl: 'notebook-report-annotations.component.html' -}) -export class NotebookReportAnnotationsComponent { - @Input() - annotations: any; - - @Input() - hasNew: boolean; - - @Input() - maxScore: string; - - nodeId: string; - componentId: string; - latestAnnotationTime: number; - show: boolean; - label: string = ''; - icon: string = 'person'; - isNew: boolean = false; - showScore: boolean = true; - showComment: boolean = true; - maxScoreDisplay: string; - - constructor(private ConfigService: ConfigService, private ProjectService: VLEProjectService) {} - - ngOnInit(): void { - this.maxScoreDisplay = parseInt(this.maxScore) > 0 ? '/' + this.maxScore : ''; - } - - getLatestAnnotation(): any { - let latestAnnotation = null; - if (this.annotations.comment || this.annotations.score) { - const commentSaveTime = this.annotations.comment - ? this.annotations.comment.serverSaveTime - : 0; - const scoreSaveTime = this.annotations.score ? this.annotations.score.serverSaveTime : 0; - if (commentSaveTime >= scoreSaveTime) { - latestAnnotation = this.annotations.comment; - } else if (scoreSaveTime > commentSaveTime) { - latestAnnotation = this.annotations.score; - } - } - return latestAnnotation; - } - - getLatestAnnotationTime(): any { - const latestAnnotation = this.getLatestAnnotation(); - if (latestAnnotation) { - return this.ConfigService.convertToClientTimestamp(latestAnnotation.serverSaveTime); - } - return null; - } - - setLabelAndIcon(): void { - const latestAnnotation = this.getLatestAnnotation(); - if (latestAnnotation) { - if (latestAnnotation.type === 'autoComment' || latestAnnotation.type === 'autoScore') { - this.label = $localize`Computer Feedback`; - this.icon = 'keyboard'; - } else { - this.label = $localize`Teacher Feedback`; - this.icon = 'person'; - } - } - } - - processAnnotations(): void { - if (this.annotations.comment || this.annotations.score) { - this.nodeId = this.annotations.comment - ? this.annotations.comment.nodeId - : this.annotations.score.nodeId; - this.componentId = this.annotations.comment - ? this.annotations.comment.componentId - : this.annotations.score.nodeId; - - if (!this.ProjectService.displayAnnotation(this.annotations.score)) { - this.showScore = false; - } - - if (!this.ProjectService.displayAnnotation(this.annotations.comment)) { - this.showComment = false; - } - - this.setLabelAndIcon(); - this.latestAnnotationTime = this.getLatestAnnotationTime(); - this.show = - (this.showScore && this.annotations.score) || - (this.showComment && this.annotations.comment); - } - } -} diff --git a/src/app/notebook/notebook-report/notebook-report.component.html b/src/app/notebook/notebook-report/notebook-report.component.html index cda8d2f9148..56da055bead 100644 --- a/src/app/notebook/notebook-report/notebook-report.component.html +++ b/src/app/notebook/notebook-report/notebook-report.component.html @@ -9,7 +9,11 @@ (click)="toggleCollapse()" fxLayoutAlign="start center" > - + assignment {{ reportItem.content.title }} @@ -53,13 +57,6 @@ (openNotebook)="addNotebookItemContent($event)" > - -
diff --git a/src/app/notebook/notebook.module.ts b/src/app/notebook/notebook.module.ts index f728d0b073e..d0772d0ba30 100644 --- a/src/app/notebook/notebook.module.ts +++ b/src/app/notebook/notebook.module.ts @@ -18,16 +18,11 @@ import { NotebookItemComponent } from './notebook-item/notebook-item.component'; import { NotebookLauncherComponent } from './notebook-launcher/notebook-launcher.component'; import { NotebookNotesComponent } from './notebook-notes/notebook-notes.component'; import { NotebookParentComponent } from './notebook-parent/notebook-parent.component'; -import { NotebookReportAnnotationsComponent } from './notebook-report-annotations/notebook-report-annotations.component'; import { NotebookReportComponent } from './notebook-report/notebook-report.component'; import { WiseTinymceEditorComponent } from '../../assets/wise5/directives/wise-tinymce-editor/wise-tinymce-editor.component'; @NgModule({ - declarations: [ - NotebookParentComponent, - NotebookReportComponent, - NotebookReportAnnotationsComponent - ], + declarations: [NotebookParentComponent, NotebookReportComponent], imports: [ CommonModule, ComponentStateInfoComponent, @@ -54,8 +49,7 @@ import { WiseTinymceEditorComponent } from '../../assets/wise5/directives/wise-t NotebookItemComponent, NotebookLauncherComponent, NotebookNotesComponent, - NotebookReportComponent, - NotebookReportAnnotationsComponent + NotebookReportComponent ] }) export class NotebookModule {} diff --git a/src/messages.xlf b/src/messages.xlf index ee4dd68a060..a35dd6fc9d9 100644 --- a/src/messages.xlf +++ b/src/messages.xlf @@ -5839,7 +5839,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it. src/app/notebook/notebook-report/notebook-report.component.html - 42 + 46 src/app/teacher/archive-projects-button/archive-projects-button.component.html @@ -6515,57 +6515,25 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.122 - - Score: - - src/app/notebook/notebook-report-annotations/notebook-report-annotations.component.html - 19,21 - - - - - - src/app/notebook/notebook-report-annotations/notebook-report-annotations.component.html - 27 - - - - Computer Feedback - - src/app/notebook/notebook-report-annotations/notebook-report-annotations.component.ts - 64 - - - - Teacher Feedback - - src/app/notebook/notebook-report-annotations/notebook-report-annotations.component.ts - 67 - - - src/assets/wise5/directives/componentAnnotations/component-annotations.component.ts - 189 - - Toggle Full Screen src/app/notebook/notebook-report/notebook-report.component.html - 22 + 26 Collapse src/app/notebook/notebook-report/notebook-report.component.html - 33 + 37 Save src/app/notebook/notebook-report/notebook-report.component.html - 72,74 + 69,71 src/assets/wise5/authoringTool/recovery-authoring/recovery-authoring.component.html @@ -6580,7 +6548,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it. Team hasn't worked on yet. src/app/notebook/notebook-report/notebook-report.component.html - 93,95 + 90,92 @@ -21501,6 +21469,13 @@ If this problem continues, let your teacher know and move on to the next activit 22 + + Teacher Feedback + + src/assets/wise5/directives/componentAnnotations/component-annotations.component.ts + 189 + + No