Skip to content

Commit

Permalink
amend error messages related to TRANSFERSTAFFRECORD
Browse files Browse the repository at this point in the history
  • Loading branch information
kapppa-joe committed Nov 14, 2024
1 parent 709f6fe commit 332d7f6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
7 changes: 3 additions & 4 deletions backend/server/models/BulkImport/csv/crossValidateErrors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion lambdas/bulkUpload/classes/workerCSVValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 332d7f6

Please sign in to comment.