diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 908e9a1a54..abae9ed77e 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,5 +1,8 @@ ## RELEASE NOTES +### Version 7.0.58 +**EXUI-2235** add event name in task completion log + ### Version 7.0.57 **EXUI-2209** MV Upgrade to v4.0.7 diff --git a/package.json b/package.json index d3d5a72fab..f447a4ce97 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hmcts/ccd-case-ui-toolkit", - "version": "7.0.57", + "version": "7.0.58", "engines": { "node": ">=18.19.0" }, diff --git a/projects/ccd-case-ui-toolkit/package.json b/projects/ccd-case-ui-toolkit/package.json index 2b4cb6a961..6d3f8c0fa5 100644 --- a/projects/ccd-case-ui-toolkit/package.json +++ b/projects/ccd-case-ui-toolkit/package.json @@ -1,6 +1,6 @@ { "name": "@hmcts/ccd-case-ui-toolkit", - "version": "7.0.57", + "version": "7.0.58", "engines": { "node": ">=18.19.0" }, diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/case-edit/case-edit.component.spec.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/case-edit/case-edit.component.spec.ts index 6f3c2083c0..69fe3a4f8e 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/case-edit/case-edit.component.spec.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/case-edit/case-edit.component.spec.ts @@ -1301,7 +1301,7 @@ describe('CaseEditComponent', () => { submit: mockClass.submit, }); - expect(mockWorkAllocationService.assignAndCompleteTask).toHaveBeenCalledWith('12345'); + expect(mockWorkAllocationService.assignAndCompleteTask).toHaveBeenCalledWith('12345', component.eventTrigger.name); }); it('should submit the case and complete task for an event submission', () => { @@ -1337,7 +1337,7 @@ describe('CaseEditComponent', () => { submit: mockClass.submit, }); - expect(mockWorkAllocationService.completeTask).toHaveBeenCalledWith('12345'); + expect(mockWorkAllocationService.completeTask).toHaveBeenCalledWith('12345', component.eventTrigger.name); }); it('should NOT submit the case due to error', () => { diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/case-edit/case-edit.component.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/case-edit/case-edit.component.ts index 956902f028..ef3f753b5c 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/case-edit/case-edit.component.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/case-edit/case-edit.component.ts @@ -476,10 +476,10 @@ export class CaseEditComponent implements OnInit, OnDestroy { const assignNeeded = this.sessionStorageService.getItem('assignNeeded') === 'true'; if (taskStr && assignNeeded) { const task: Task = JSON.parse(taskStr); - return this.workAllocationService.assignAndCompleteTask(task.id); + return this.workAllocationService.assignAndCompleteTask(task.id, this.eventTrigger.name); } else if (taskStr) { const task: Task = JSON.parse(taskStr); - return this.workAllocationService.completeTask(task.id); + return this.workAllocationService.completeTask(task.id, this.eventTrigger.name); } return of(true); } diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/services/work-allocation.service.spec.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/services/work-allocation.service.spec.ts index f0d17da7d0..d3550e8d45 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/services/work-allocation.service.spec.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/services/work-allocation.service.spec.ts @@ -220,8 +220,8 @@ describe('WorkAllocationService', () => { })); it('should call post with the correct parameters', () => { - workAllocationService.completeTask(MOCK_TASK_1.id).subscribe(); - expect(httpService.post).toHaveBeenCalledWith(TASK_COMPLETE_URL, { actionByEvent: true }); + workAllocationService.completeTask(MOCK_TASK_1.id, 'Add case number').subscribe(); + expect(httpService.post).toHaveBeenCalledWith(TASK_COMPLETE_URL, { actionByEvent: true, eventName: 'Add case number' }); }); it('should set error service error when the call fails', (done) => { @@ -254,8 +254,8 @@ describe('WorkAllocationService', () => { })); it('should call post with the correct parameters', () => { - workAllocationService.assignAndCompleteTask(MOCK_TASK_1.id).subscribe(); - expect(httpService.post).toHaveBeenCalledWith(TASK_COMPLETE_URL, {completion_options: {assign_and_complete: true}, actionByEvent: true}); + workAllocationService.assignAndCompleteTask(MOCK_TASK_1.id, 'Add case number').subscribe(); + expect(httpService.post).toHaveBeenCalledWith(TASK_COMPLETE_URL, {completion_options: {assign_and_complete: true}, actionByEvent: true, eventName: 'Add case number'}); }); it('should set error service error when the call fails', (done) => { @@ -333,7 +333,7 @@ describe('WorkAllocationService', () => { tasks: [ MOCK_TASK_2 ] })); workAllocationService.completeAppropriateTask('1234567890', 'event', 'IA', 'caseType').subscribe(result => { - expect(completeSpy).toHaveBeenCalledWith(MOCK_TASK_2.id); + expect(completeSpy).toHaveBeenCalledWith(MOCK_TASK_2.id, 'event'); done(); }); }); @@ -362,7 +362,7 @@ describe('WorkAllocationService', () => { // Should not get here... so if we do, make sure it fails. done.fail('Completed task instead of erroring'); }, error => { - expect(completeSpy).toHaveBeenCalledWith(MOCK_TASK_2.id); + expect(completeSpy).toHaveBeenCalledWith(MOCK_TASK_2.id, 'event'); expect(error.message).toEqual(COMPLETE_ERROR.message); // The error for completing the task. done(); }); diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/services/work-allocation.service.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/services/work-allocation.service.ts index 4c89e135bf..81ea2bc96d 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/services/work-allocation.service.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/services/work-allocation.service.ts @@ -98,14 +98,14 @@ export class WorkAllocationService { * Call the API to complete a task. * @param taskId specifies which task should be completed. */ - public completeTask(taskId: string): Observable { + public completeTask(taskId: string, eventName?: string): Observable { if (!this.isWAEnabled()) { return of(null); } console.log(`completeTask: completing ${taskId}`); const url = `${this.appConfig.getWorkAllocationApiUrl()}/task/${taskId}/complete`; return this.http - .post(url, { actionByEvent: true }) + .post(url, { actionByEvent: true, eventName: eventName }) .pipe( catchError(error => { this.errorService.setError(error); @@ -122,7 +122,7 @@ export class WorkAllocationService { * Call the API to assign and complete a task. * @param taskId specifies which task should be completed. */ - public assignAndCompleteTask(taskId: string): Observable { + public assignAndCompleteTask(taskId: string, eventName?: string): Observable { if (!this.isWAEnabled()) { return of(null); } @@ -132,7 +132,8 @@ export class WorkAllocationService { completion_options: { assign_and_complete: true }, - actionByEvent: true + actionByEvent: true, + eventName: eventName }) .pipe( catchError(error => { @@ -196,7 +197,7 @@ export class WorkAllocationService { const tasks: any[] = response.tasks; if (tasks && tasks.length > 0) { if (tasks.length === 1) { - this.completeTask(tasks[0].id).subscribe(); + this.completeTask(tasks[0].id, eventId).subscribe(); } else { // This is a problem. Throw an appropriate error. throw new Error(MULTIPLE_TASKS_FOUND);