From 332d7f6726c830de39bbf18e224deb0ca594cef1 Mon Sep 17 00:00:00 2001 From: Joe Fong Date: Thu, 14 Nov 2024 12:50:10 +0000 Subject: [PATCH] amend error messages related to TRANSFERSTAFFRECORD --- .../models/BulkImport/csv/crossValidateErrors.js | 7 +++---- .../unit/models/Bulkimport/csv/crossValidate.spec.js | 10 ++++------ lambdas/bulkUpload/classes/workerCSVValidator.js | 2 +- .../test/unit/classes/workerCSVValidator.spec.js | 2 +- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/backend/server/models/BulkImport/csv/crossValidateErrors.js b/backend/server/models/BulkImport/csv/crossValidateErrors.js index 560254e91b..c5a8ae864b 100644 --- a/backend/server/models/BulkImport/csv/crossValidateErrors.js +++ b/backend/server/models/BulkImport/csv/crossValidateErrors.js @@ -18,22 +18,21 @@ const TRANSFER_STAFF_RECORD_ERRORS = { errType: 'TRANSFERSTAFFRECORD_ERROR', column: 'TRANSFERSTAFFRECORD', _sourceFieldName: 'transferStaffRecord', - error: 'Cannot find an existing workplace with the reference provided in TRANSFERSTAFFRECORD', + error: 'The LOCALESTID in TRANSFERSTAFFRECORD does not exist', }), SameLocalIdExistInNewWorkplace: Object.freeze({ errCode: TRANSFER_STAFF_RECORD_BASE_ERROR_CODE + 2, errType: 'TRANSFERSTAFFRECORD_ERROR', column: 'UNIQUEWORKERID', _sourceFieldName: 'uniqueWorkerId', - error: 'The UNIQUEWORKERID for this worker is already used in the new workplace given in TRANSFERSTAFFRECORD', + error: 'The UNIQUEWORKERID already exists in the LOCALESTID given in TRANSFERSTAFFRECORD', }), SameRefsMovingToWorkplace: Object.freeze({ errCode: TRANSFER_STAFF_RECORD_BASE_ERROR_CODE + 3, errType: 'TRANSFERSTAFFRECORD_ERROR', column: 'UNIQUEWORKERID', _sourceFieldName: 'uniqueWorkerId', - error: - 'There are more than one worker with this UNIQUEWORKERID moving into the new workplace given in TRANSFERSTAFFRECORD.', + error: 'Duplicate UNIQUEWORKERID’s are being moved to the same LOCALESTID in TRANSFERSTAFFRECORD', }), }; diff --git a/backend/server/test/unit/models/Bulkimport/csv/crossValidate.spec.js b/backend/server/test/unit/models/Bulkimport/csv/crossValidate.spec.js index c11eb2594a..1b43ef1ae7 100644 --- a/backend/server/test/unit/models/Bulkimport/csv/crossValidate.spec.js +++ b/backend/server/test/unit/models/Bulkimport/csv/crossValidate.spec.js @@ -266,7 +266,7 @@ describe('crossValidate', () => { column: 'TRANSFERSTAFFRECORD', errCode: 1401, errType: 'TRANSFERSTAFFRECORD_ERROR', - error: 'Cannot find an existing workplace with the reference provided in TRANSFERSTAFFRECORD', + error: 'The LOCALESTID in TRANSFERSTAFFRECORD does not exist', worker: JSONWorker.uniqueWorkerId, name: JSONWorker.localId, lineNumber: JSONWorker.lineNumber, @@ -297,7 +297,7 @@ describe('crossValidate', () => { column: 'UNIQUEWORKERID', errCode: 1402, errType: 'TRANSFERSTAFFRECORD_ERROR', - error: 'The UNIQUEWORKERID for this worker is already used in the new workplace given in TRANSFERSTAFFRECORD', + error: 'The UNIQUEWORKERID already exists in the LOCALESTID given in TRANSFERSTAFFRECORD', worker: JSONWorker.uniqueWorkerId, name: JSONWorker.localId, lineNumber: JSONWorker.lineNumber, @@ -323,8 +323,7 @@ describe('crossValidate', () => { column: 'UNIQUEWORKERID', errCode: 1403, errType: 'TRANSFERSTAFFRECORD_ERROR', - error: - 'There are more than one worker with this UNIQUEWORKERID moving into the new workplace given in TRANSFERSTAFFRECORD.', + error: 'Duplicate UNIQUEWORKERID’s are being moved to the same LOCALESTID in TRANSFERSTAFFRECORD', worker: JSONWorkerB.uniqueWorkerId, name: JSONWorkerB.localId, lineNumber: JSONWorkerB.lineNumber, @@ -353,8 +352,7 @@ describe('crossValidate', () => { column: 'UNIQUEWORKERID', errCode: 1403, errType: 'TRANSFERSTAFFRECORD_ERROR', - error: - 'There are more than one worker with this UNIQUEWORKERID moving into the new workplace given in TRANSFERSTAFFRECORD.', + error: 'Duplicate UNIQUEWORKERID’s are being moved to the same LOCALESTID in TRANSFERSTAFFRECORD', worker: movingWorker.uniqueWorkerId, name: movingWorker.localId, lineNumber: movingWorker.lineNumber, diff --git a/lambdas/bulkUpload/classes/workerCSVValidator.js b/lambdas/bulkUpload/classes/workerCSVValidator.js index f925f02f32..1fa6292470 100644 --- a/lambdas/bulkUpload/classes/workerCSVValidator.js +++ b/lambdas/bulkUpload/classes/workerCSVValidator.js @@ -777,7 +777,7 @@ class WorkerCsvValidator { lineNumber: this._lineNumber, errCode: WorkerCsvValidator.TRANSFERSTAFFRECORD_ERROR, errType: 'TRANSFERSTAFFRECORD_ERROR', - error: `TRANSFERSTAFFRECORD is provided but cannot find the worker in the given workplace`, + error: 'Staff record has TRANSFERSTAFFRECORD given but does not exist', source: this._currentLine.LOCALESTID, column: 'LOCALESTID', }); diff --git a/lambdas/bulkUpload/test/unit/classes/workerCSVValidator.spec.js b/lambdas/bulkUpload/test/unit/classes/workerCSVValidator.spec.js index 5df9127687..a15f178c1d 100644 --- a/lambdas/bulkUpload/test/unit/classes/workerCSVValidator.spec.js +++ b/lambdas/bulkUpload/test/unit/classes/workerCSVValidator.spec.js @@ -1448,7 +1448,7 @@ describe('/lambdas/bulkUpload/classes/workerCSVValidator', async () => { lineNumber: 2, errCode: WorkerCsvValidator.TRANSFERSTAFFRECORD_ERROR, errType: 'TRANSFERSTAFFRECORD_ERROR', - error: 'TRANSFERSTAFFRECORD is provided but cannot find the worker in the given workplace', + error: 'Staff record has TRANSFERSTAFFRECORD given but does not exist', source: worker.LOCALESTID, column: 'LOCALESTID', name: 'MARMA',