Skip to content

#4226 - NOA Eligible to Receive - Double Counting BC Grants #4238

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

Merged
merged 5 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,124 @@ describe("AssessmentStudentsController(e2e)-getAssessmentNOA", () => {
.expect(expectation);
});

it("Should exclude BC Total Grant from eligible amount calculation when getting NOA details", async () => {
// Arrange
const student = await saveFakeStudent(db.dataSource);
await mockUserLoginInfo(appModule, student);

// Create signed MSFAA
const msfaaNumber = createFakeMSFAANumber(
{ student },
{
msfaaState: MSFAAStates.Signed,
},
);
await db.msfaaNumber.save(msfaaNumber);

const application = await saveFakeApplicationDisbursements(
Copy link
Collaborator

Choose a reason for hiding this comment

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

The saveFakeApplicationDisbursements can do the whole date preparation and we can discard all the code from line 185-237.

const application = await saveFakeApplicationDisbursements(
      db.dataSource,
      {
        msfaaNumber,
        student,
        disbursementValues: [
          // BC Total Grant (excluded from eligible amount)
          createFakeDisbursementValue(
            DisbursementValueType.BCTotalGrant,
            "BCSG",
            540,
          ),
          // Canada Student Loans and Grants
          createFakeDisbursementValue(
            DisbursementValueType.CanadaLoan,
            "CSLF",
            0,
          ),
          createFakeDisbursementValue(
            DisbursementValueType.CanadaGrant,
            "CSGP",
            0,
          ),
          createFakeDisbursementValue(
            DisbursementValueType.CanadaGrant,
            "CSPT",
            2520,
          ),
          // BC Grants
          createFakeDisbursementValue(
            DisbursementValueType.BCGrant,
            "BCAG",
            140,
          ),
          createFakeDisbursementValue(
            DisbursementValueType.BCGrant,
            "SBSD",
            400,
          ),
        ],
      },
      {
        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.

In the code snippet above, I used (CSLF instead of CSLP) to be in sync with the offering intensity.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks @dheepak-aot
Grant assert values updated.

db.dataSource,
{
msfaaNumber,
student,
disbursementValues: [
// BC Total Grant (excluded from eligible amount)
createFakeDisbursementValue(
DisbursementValueType.BCTotalGrant,
"BCSG",
540,
),
// Canada Student Loans and Grants
createFakeDisbursementValue(
DisbursementValueType.CanadaLoan,
"CSLF",
0,
),
createFakeDisbursementValue(
DisbursementValueType.CanadaGrant,
"CSGP",
0,
),
createFakeDisbursementValue(
DisbursementValueType.CanadaGrant,
"CSGF",
2520,
),
// BC Grants
createFakeDisbursementValue(
DisbursementValueType.BCGrant,
"BCAG",
140,
),
createFakeDisbursementValue(
DisbursementValueType.BCGrant,
"SBSD",
400,
),
],
},
{
offeringIntensity: OfferingIntensity.fullTime,
},
);

const assessment = application.currentAssessment;
const [disbursement] = assessment.disbursementSchedules;

const endpoint = `/students/assessment/${assessment.id}/noa`;
const studentUserToken = await getStudentToken(
FakeStudentUsersTypes.FakeStudentUserType1,
);

const expectedNOADetails = {
applicationId: application.id,
applicationNumber: application.applicationNumber,
applicationStatus: application.applicationStatus,
assessment: assessment.assessmentData,
noaApprovalStatus: assessment.noaApprovalStatus,
applicationCurrentAssessmentId: application.currentAssessment.id,
fullName: getUserFullName(application.student.user),
programName: assessment.offering.educationProgram.name,
locationName: assessment.offering.institutionLocation.name,
offeringIntensity: OfferingIntensity.fullTime,
offeringStudyEndDate: getDateOnlyFullMonthFormat(
assessment.offering.studyEndDate,
),
offeringStudyStartDate: getDateOnlyFullMonthFormat(
assessment.offering.studyStartDate,
),
// Sum of CSGF(2520) + BCAG(140) + SBSD(400), excluding BCSG(540)
eligibleAmount: 3060,
disbursement: {
disbursement1COEStatus: disbursement.coeStatus,
disbursement1Date: getDateOnlyFullMonthFormat(
disbursement.disbursementDate,
),
disbursement1Id: disbursement.id,
disbursement1MSFAACancelledDate:
disbursement.msfaaNumber?.cancelledDate,
disbursement1MSFAADateSigned: disbursement.msfaaNumber?.dateSigned,
disbursement1MSFAAId: disbursement.msfaaNumber?.id,
disbursement1MSFAANumber: msfaaNumber.msfaaNumber,
disbursement1Status: disbursement.disbursementScheduleStatus,
disbursement1TuitionRemittance:
disbursement.tuitionRemittanceRequestedAmount,
disbursement1cslf: 0,
disbursement1csgp: 0,
disbursement1csgf: 2520,
disbursement1bcag: 140,
disbursement1sbsd: 400,
},
offeringName: assessment.offering.name,
};

// Act/Assert
await request(app.getHttpServer())
.get(endpoint)
.auth(studentUserToken, BEARER_AUTH_TYPE)
.expect(HttpStatus.OK)
.expect(expectedNOADetails);
});

afterAll(async () => {
await app?.close();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ export class AssessmentControllerService {
.flatMap(
(disbursementSchedule) => disbursementSchedule.disbursementValues,
)
.filter(
(disbursementValue) =>
disbursementValue.valueType !== DisbursementValueType.BCTotalGrant,
)
.reduce(
(accumulator, disbursementValue) =>
accumulator + disbursementValue.valueAmount,
Expand Down
Loading