From 6993f6c4bf2c455bb83561748e667f4be0b6f667 Mon Sep 17 00:00:00 2001 From: Shashank Shekhar Date: Thu, 9 Nov 2023 09:17:31 -0800 Subject: [PATCH] #2112 - Application Bulk Withdrawal: Business Validations - Bug Fix (#2491) ## As a part of this PR, the following is fixed: **Bug:** When an application record in the bulk withdrawal file where the student has previously withdrawn from the program (scholastic standing) is processed and the same record in the file also has an incorrect value of SIN: ### The below errors and warnings are shown: image ### **[Fix]** Instead the following errors and warnings must be shown: image --- ...lication-bulk-withdrawal-import-text.service.ts | 7 ++++--- ...pplication-bulk-withdrawal-validation.models.ts | 14 -------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/sources/packages/backend/apps/api/src/services/application-bulk-withdrawal/application-bulk-withdrawal-import-text.service.ts b/sources/packages/backend/apps/api/src/services/application-bulk-withdrawal/application-bulk-withdrawal-import-text.service.ts index a68422e241..7f71d088f4 100644 --- a/sources/packages/backend/apps/api/src/services/application-bulk-withdrawal/application-bulk-withdrawal-import-text.service.ts +++ b/sources/packages/backend/apps/api/src/services/application-bulk-withdrawal/application-bulk-withdrawal-import-text.service.ts @@ -177,10 +177,11 @@ export class ApplicationWithdrawalImportTextService { textValidation.textModel.applicationNumber; validationModel.withdrawalDate = textValidation.textModel.withdrawalDate; validationModel.applicationFound = false; - if (applicationData) { + if ( + applicationData && + textValidation.textModel.sin === applicationData.sin + ) { validationModel.applicationFound = true; - validationModel.studentSINMatch = - textValidation.textModel.sin === applicationData.sin; validationModel.isArchived = applicationData.isArchived; validationModel.applicationStatus = applicationData.applicationStatus; validationModel.hasPreviouslyBeenWithdrawn = diff --git a/sources/packages/backend/apps/api/src/services/application-bulk-withdrawal/application-bulk-withdrawal-validation.models.ts b/sources/packages/backend/apps/api/src/services/application-bulk-withdrawal/application-bulk-withdrawal-validation.models.ts index da7a946882..65d8c46022 100644 --- a/sources/packages/backend/apps/api/src/services/application-bulk-withdrawal/application-bulk-withdrawal-validation.models.ts +++ b/sources/packages/backend/apps/api/src/services/application-bulk-withdrawal/application-bulk-withdrawal-validation.models.ts @@ -66,20 +66,6 @@ export class ApplicationBulkWithdrawalValidationModel { ), }) applicationFound: boolean; - /** - * Valid SIN. - */ - @ValidateIf( - (object: ApplicationBulkWithdrawalValidationModel) => - object.applicationFound, - ) - @IsIn([true], { - message: "The record was not found and will be skipped.", - context: ValidationContext.CreateWarning( - ApplicationWithdrawalValidationWarnings.NoMatchingRecordFound, - ), - }) - studentSINMatch?: boolean; /** * Application Status. */