From 819780a5e2aab53a00f4f9cb0dcf8dfefc1f9896 Mon Sep 17 00:00:00 2001 From: pbardy2000 <146740183+pbardy2000@users.noreply.github.com> Date: Thu, 13 Jun 2024 11:17:09 +0100 Subject: [PATCH 1/5] fix(cb2-12599): ensure additional examiner notes appear in the correct order --- ...adr-examiner-notes-history.component-edit.ts | 17 +++++++++-------- ...r-examiner-notes-history-view.component.html | 2 +- ...xaminer-notes-history-view.component.spec.ts | 4 ++-- ...adr-examiner-notes-history-view.component.ts | 10 ++++++---- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.ts b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.ts index 08e212cf4e..088856dbfb 100644 --- a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.ts +++ b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.ts @@ -1,20 +1,19 @@ import { KeyValue, ViewportScroller } from '@angular/common'; import { - AfterContentInit, - Component, inject, OnDestroy, OnInit, + AfterContentInit, Component, OnDestroy, OnInit, inject, } from '@angular/core'; import { FormArray, NgControl } from '@angular/forms'; +import { ActivatedRoute, Router } from '@angular/router'; +import { AdditionalExaminerNotes } from '@dvsa/cvs-type-definitions/types/v3/tech-record/get/hgv/complete'; import { TechRecordType } from '@dvsa/cvs-type-definitions/types/v3/tech-record/tech-record-vehicle-type'; import { BaseControlComponent } from '@forms/components/base-control/base-control.component'; import { CustomControl, CustomFormControl } from '@forms/services/dynamic-form.types'; +import { ReasonForEditing } from '@models/vehicle-tech-record.model'; +import { Store } from '@ngrx/store'; import { TechnicalRecordService } from '@services/technical-record/technical-record.service'; -import { ReplaySubject, takeUntil } from 'rxjs'; import { updateScrollPosition } from '@store/technical-records'; import { TechnicalRecordServiceState } from '@store/technical-records/reducers/technical-record-service.reducer'; -import { Store } from '@ngrx/store'; -import { ActivatedRoute, Router } from '@angular/router'; -import { ReasonForEditing } from '@models/vehicle-tech-record.model'; -import { AdditionalExaminerNotes } from '@dvsa/cvs-type-definitions/types/v3/tech-record/get/hgv/complete'; +import { ReplaySubject, takeUntil } from 'rxjs'; @Component({ selector: 'app-adr-examiner-notes-history', @@ -62,7 +61,9 @@ export class AdrExaminerNotesHistoryEditComponent extends BaseControlComponent i } getAdditionalExaminerNotes(): AdditionalExaminerNotes[] { - return this.currentTechRecord?.techRecord_adrDetails_additionalExaminerNotes ?? []; + return (this.currentTechRecord?.techRecord_adrDetails_additionalExaminerNotes ?? []).sort( + (a, b) => +new Date(b.createdAtDate ?? '') - +new Date(a.createdAtDate ?? ''), + ); } get currentAdrNotesPage(): AdditionalExaminerNotes[] { diff --git a/src/app/forms/custom-sections/adr-examiner-notes-history-view/adr-examiner-notes-history-view.component.html b/src/app/forms/custom-sections/adr-examiner-notes-history-view/adr-examiner-notes-history-view.component.html index 3b4d2d078f..640de5f158 100644 --- a/src/app/forms/custom-sections/adr-examiner-notes-history-view/adr-examiner-notes-history-view.component.html +++ b/src/app/forms/custom-sections/adr-examiner-notes-history-view/adr-examiner-notes-history-view.component.html @@ -1,5 +1,5 @@ - +