-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#4155 - Disbursement Receipt Process - Expectations on Fail #4232
#4155 - Disbursement Receipt Process - Expectations on Fail #4232
Conversation
...packages/backend/apps/db-migrations/src/sql/Queue/Update-disbursement-receipts-file-cron.sql
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,11 @@ | |||
update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we do these keywords in uppercase? For other places and files too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we following this in our PRs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my previous understanding, I don't think that we are using lowercase for keywords anywhere.
@@ -62,6 +62,13 @@ export class DisbursementReceiptProcessingService { | |||
this.esdcConfig.ftpResponseFolder, | |||
fileSearch, | |||
); | |||
// Throw an error if there are no files to be processed. | |||
if (filePaths.length === 0) { | |||
processSummary.error( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
...esdc-integration/disbursement-receipt-integration/disbursement-receipt.processing.service.ts
Show resolved
Hide resolved
SELECT | ||
1 | ||
FROM | ||
disbursement_receipt_dataset |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the FROM be disbursement_receipts
.
Currently, disbursement_receipt_dataset
also works since the where
conditions are the same but in future if the where
conditions inside the inner select
statement changes, the inner query might not return any data and therefore, if that happens, we will have to add the empty record line as expected by the business but as per the current logic it won't get added.
Just a suggestion to change it to disbursement_receipts
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be from the disbursement_receipt_dataset
as we are trying to provide a default record when the dataset is empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dheepak-aot Right now the where
conditions in the view selected at the top via disbursement_receipt_dataset
and the SELECT
immediately below it are the same. In future, it might very well happen that the SELECT
has a different WHERE
condition which results in removing everything from the above selected view. If this happens, we will have to add the empty record line as expected by the business but as per the current logic it won't get added.
...ntegration/ecert-integration/_tests_/disbursement-receipts-integration.scheduler.e2e-spec.ts
Outdated
Show resolved
Hide resolved
...ntegration/ecert-integration/_tests_/disbursement-receipts-integration.scheduler.e2e-spec.ts
Outdated
Show resolved
Hide resolved
...s/backend/apps/db-migrations/src/sql/Reports/Update-daily-disbursement-file-zero-records.sql
Outdated
Show resolved
Hide resolved
...s/backend/apps/db-migrations/src/sql/Reports/Update-daily-disbursement-file-zero-records.sql
Outdated
Show resolved
Hide resolved
...ntegration/ecert-integration/_tests_/disbursement-receipts-integration.scheduler.e2e-spec.ts
Outdated
Show resolved
Hide resolved
...ntegration/ecert-integration/_tests_/disbursement-receipts-integration.scheduler.e2e-spec.ts
Outdated
Show resolved
Hide resolved
...ntegration/ecert-integration/_tests_/disbursement-receipts-integration.scheduler.e2e-spec.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @guru-aot . Left a few comments.
...ntegration/ecert-integration/_tests_/disbursement-receipts-integration.scheduler.e2e-spec.ts
Outdated
Show resolved
Hide resolved
expect(fileContent).toContain( | ||
"Full Time BC Student Loan,Full Time BC Student Grant,Full Time BC Total,Part Time BC Student Grant,Part Time BC Total,BC Total,Total Records,File Date,Batch Run Date,Sequence Number", | ||
); | ||
expect(fileContent).toContain("0,0,0,0,0,0,0,2024-01-31,,3228"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The date and sequence number can be used a constant so that it can be used across many tests in the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the constant that is already defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it is from existing code.
const createdNotification = await db.notification.findOne({ | ||
select: { | ||
id: true, | ||
dateSent: true, | ||
messagePayload: true, | ||
notificationMessage: { id: true, templateId: true }, | ||
}, | ||
relations: { notificationMessage: true }, | ||
where: { | ||
dateSent: IsNull(), | ||
notificationMessage: { | ||
id: NotificationMessageType.MinistryNotificationProvincialDailyDisbursementReceipt, | ||
}, | ||
}, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor and not blocker. I see this code repeating a lot. We can create a common function and re-use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do as part of another effort
...esdc-integration/disbursement-receipt-integration/disbursement-receipt.processing.service.ts
Outdated
Show resolved
Hide resolved
UNION | ||
ALL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While setting a default record on result set being empty UNION vs UNION ALL does not make any difference and UNION is more accurate here. But I won't consider it as blocker.
Great work @guru-aot. Please have a look at the comments. |
...s/backend/apps/db-migrations/src/sql/Reports/Update-daily-disbursement-file-zero-records.sql
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing the changes. Looks good 👍
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @guru-aot 👍
Rollback change migration screenshot
REPORT change to generate the zero record CSV.
CRON change for queue-configuration.
E2E test cases added and updated the existing e2e.