Skip to content
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

#3453 - COE for $0/Not Eligible Assessments - Part 2 #4027

Merged
merged 4 commits into from
Dec 10, 2024

Conversation

lewischen-aot
Copy link
Collaborator

@lewischen-aot lewischen-aot commented Dec 4, 2024

This PR resolves the following business AC:

  • Do not show $0/Ineligible requests in the COE Requests Report.
  • Do not send ECE requests to institutions for $0/Ineligible COE requests.

This PR covers the changes for COE Request report and e-Cert integration/queue consumer.

  • Updated COE Request report SQL script to exclude disbursements that don't have estimated awards.
  • Used the flag for the e-Cert validations, integration and queueu-consumers.
  • Modified existing E2E tests for ECE and API
    • Added test case "Should generate the COE Requests report without application(s) that don't have estimated awards when one or more applications exist for the given institution."

Rollback Evidence

image

@lewischen-aot lewischen-aot self-assigned this Dec 4, 2024
@lewischen-aot lewischen-aot marked this pull request as ready for review December 4, 2024 23:48
@dheepak-aot dheepak-aot self-requested a review December 5, 2024 17:17
sims.report_configs
SET
report_sql = (
'SELECT
Copy link
Collaborator

@dheepak-aot dheepak-aot Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor. Please format the sql with our VS code formatting. Same for the revert.

It can be done by copying query to new text file and doing this.

image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please let me know if you need help with the formatting.

@dheepak-aot
Copy link
Collaborator

Great Job @lewischen-aot . Please have a look at the comments. Most of them are minor comments.

Also please add a E2E test for ECE as per the technical AC.

image


beforeEach(async () => {
jest.clearAllMocks();
// Ensures that every disbursement on database has no estimated awards
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the comment. It seems to be moved over from e-certs.

}),
},
{
offeringIntensity: OfferingIntensity.fullTime,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have the COE Status deliberately mentioned?

image

Comment on lines 149 to 163
expect(fileDetail).toContain(
application.currentAssessment.offering.institutionLocation
.institutionCode,
);
expect(fileDetail).toContain(disbursementValue.id.toString());
expect(fileDetail).toContain(disbursementValue.valueCode.toString());
expect(fileDetail).toContain(disbursementValue.valueAmount.toString());
expect(fileDetail).toContain(
application.student.user.lastName.slice(0, 25),
);
expect(fileDetail).toContain(
application.student.user.firstName.slice(0, 15),
);
expect(fileDetail).toContain(application.applicationNumber);
expect(fileDetail).toContain(application.studentNumber);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend the file detail to assert exact match instead of contain.

I can be achieved by creating a parser.

function buildECEFileDetail(
      application: Application,
      disbursementValue: DisbursementValue,
      disbursementDate: string,
    ): string {
      const DATE_FORMAT = "YYYYMMDD";
      const offering = application.currentAssessment.offering;
      const studyStartDate = formatDate(offering.studyStartDate, DATE_FORMAT);
      const studyEndDate = formatDate(offering.studyEndDate, DATE_FORMAT);
      const disbursementDateFormatted = formatDate(
        disbursementDate,
        DATE_FORMAT,
      );
      const institutionLocation = offering.institutionLocation;
      const student = application.student;
      const studentFirstName = student.user.firstName?.substring(0, 15) ?? "";
      const studentLastName = student.user.lastName.substring(0, 25);
      const studentBirthDate = formatDate(student.birthDate, DATE_FORMAT);
      const institutionStudentNumber = application.studentNumber;
      return `${RecordTypeCodes.ECEDetail}${
        institutionLocation.institutionCode
      }${disbursementValue.id.toString().padStart(10, "0")}${
        disbursementValue.valueCode
      }${disbursementValue.valueAmount.toString().padStart(9, "0")}${
        student.sinValidation.sin
      }${studentLastName.padEnd(25, " ")}${studentFirstName.padEnd(
        15,
        " ",
      )}${studentBirthDate}${
        application.applicationNumber
      }${institutionStudentNumber.padEnd(
        12,
        " ",
      )}100${studyStartDate}${studyEndDate}${disbursementDateFormatted}`;
    }

and calling the parser like this.

const [disbursement] =
        application.currentAssessment.disbursementSchedules;
      const [disbursementValue] = disbursement.disbursementValues;
      const expectedDetailRecord = buildECEFileDetail(
        application,
        disbursementValue,
        disbursement.disbursementDate,
      );
      expect(fileDetail).toBe(expectedDetailRecord);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also tested the result before sharing the above suggestion.

image

expect(fileDetail).toContain(application.applicationNumber);
expect(fileDetail).toContain(application.studentNumber);
// Expect the footer contain only 1 disbursement schedule.
expect(footer).toContain("1");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please assert the footer like this.
expect(footer).toBe("3000001");

import * as Client from "ssh2-sftp-client";
import * as dayjs from "dayjs";

describe(QueueNames.ECEProcessIntegration, () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the util describeQueueProcessorRootTest(QueueNames.ECEProcessIntegration) to follow other scheduler descriptions

Comment on lines 48 to 50
// Ensures that every institution location on database has no integration.
// to allow the e-Certs to be generated with the data created for every
// specific scenario.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments still say e-cert. Please adjust the comments.

Copy link
Collaborator

@dheepak-aot dheepak-aot left a 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 👍

Please address the 2 minor comments before merge.

#4027 (comment)
#4027 (comment)

Copy link

Backend Unit Tests Coverage Report

Totals Coverage
Statements: 21.97% ( 3753 / 17083 )
Methods: 10.1% ( 215 / 2129 )
Lines: 25.32% ( 3258 / 12869 )
Branches: 13.43% ( 280 / 2085 )

Copy link

E2E Workflow Workers Coverage Report

Totals Coverage
Statements: 65.43% ( 583 / 891 )
Methods: 59.26% ( 64 / 108 )
Lines: 68.54% ( 464 / 677 )
Branches: 51.89% ( 55 / 106 )

Copy link

E2E Queue Consumers Coverage Report

Totals Coverage
Statements: 84.94% ( 1342 / 1580 )
Methods: 83.33% ( 135 / 162 )
Lines: 86.45% ( 1129 / 1306 )
Branches: 69.64% ( 78 / 112 )

Copy link

E2E SIMS API Coverage Report

Totals Coverage
Statements: 67.16% ( 5869 / 8739 )
Methods: 64.75% ( 722 / 1115 )
Lines: 71.15% ( 4612 / 6482 )
Branches: 46.85% ( 535 / 1142 )

},
},
);
application.studentNumber = "1234567789";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need the studentNumber? That is nullable in sims.applications.

Copy link
Collaborator

@andrepestana-aot andrepestana-aot Dec 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change buildECEFileDetail to do not require application.studentNumber as it's not required for the e-Cert generation. (Edit: I meant ECE)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point @andrepestana-aot. I also thought that student number was not required, until the E2E test failed due to the null value from institutionStudentNumber used by the following code in the method getFixedFormat() in ece-file-detail.ts:

      record.appendWithEndFiller(
        this.institutionStudentNumber,
        12,
        SPACE_FILLER,
      );

In this case, institutionStudentNumber is studentNumber obtained from another method. When the value institutionStudentNumber is null, the method appendWithEndFiller will raise a type error as shown below.
image

Setting a value for studentNumber for the application in the E2E test will make it pass. In short, student number should be a mandatory field for submitting student applications, and the ECE request process integration ensures that student number is required. If there is any further doubts about this, I think we can raise the question in DEV meetings and make corresponding changes in separate story.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I see. That is required for the ECE integration. Thanks for checking. We can confirm that later with other DEVS.

Copy link
Collaborator

@andrepestana-aot andrepestana-aot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! Just a minor comment.

Copy link
Collaborator

@andrepestana-aot andrepestana-aot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for checking my question. Looks good!

@lewischen-aot lewischen-aot added this pull request to the merge queue Dec 10, 2024
Merged via the queue into main with commit b24e4a6 Dec 10, 2024
21 checks passed
@lewischen-aot lewischen-aot deleted the feature/#3453-coe-ineligible-assessments-part2 branch December 10, 2024 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants