Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
guru-aot committed Dec 19, 2024
1 parent ba4bb88 commit 4873ee4
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import { MaxJobsToActivate } from "../../types";
import {
AssessmentSequentialProcessingService,
AwardTotal,
FTProgramYearContributionTotal,
ProgramYearTotal,
SystemUsersService,
WorkflowClientService,
Expand Down Expand Up @@ -446,7 +447,11 @@ export class AssessmentController {
jobLogger.log(
`The assessment calculation order has been verified and the assessment id ${assessmentId} is ready to be processed.`,
);
this.createOutputForProgramYearTotals(programYearTotalAwards, result);
this.createOutputForProgramYearTotals(
programYearTotalAwards,
ftProgramYearContributionTotal,
result,
);
result.isReadyForCalculation = true;
return job.complete(result);
}
Expand All @@ -473,6 +478,7 @@ export class AssessmentController {
*/
private createOutputForProgramYearTotals(
programYearTotalAwards: AwardTotal[],
ftProgramYearContributionTotal: FTProgramYearContributionTotal[],
output: VerifyAssessmentCalculationOrderJobOutDTO,
): void {
// Create the dynamic variables to be outputted.
Expand All @@ -486,6 +492,12 @@ export class AssessmentController {
? output[outputName] + award.total
: award.total;
});
ftProgramYearContributionTotal.forEach((contributionTotal) => {
const outputName = `programYearTotal${contributionTotal.contribution}`;
output[outputName] = output[outputName]
? output[outputName] + contributionTotal.total
: contributionTotal.total;
});
}

private async getProgramYearTotals(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ import {
} from "..";
import { InjectRepository } from "@nestjs/typeorm";
import { getISODateOnlyString } from "@sims/utilities";
import { StudentAssessmentDetail } from "./student-assessment.model";
import {
FullTimeStudentContributionType,
StudentAssessmentDetail,
} from "./student-assessment.model";

@Injectable()
export class AssessmentSequentialProcessingService {
Expand Down Expand Up @@ -303,17 +306,20 @@ export class AssessmentSequentialProcessingService {

// Map the results to the required interface
const result: FTProgramYearContributionTotal[] = [
{ contribution: "totalFederalFSC", total: totals.totalFederalFSC ?? 0 },
{
contribution: "totalProvincialFSC",
contribution: FullTimeStudentContributionType.FederalFSC,
total: totals.totalFederalFSC ?? 0,
},
{
contribution: FullTimeStudentContributionType.ProvincialFSC,
total: totals.totalProvincialFSC ?? 0,
},
{
contribution: "studentScholarshipsBursaries",
contribution: FullTimeStudentContributionType.ScholarshipBursaries,
total: totals.studentScholarshipsBursaries ?? 0,
},
{
contribution: "studentSpouseContribution",
contribution: FullTimeStudentContributionType.SpouseContributionWeeks,
total: totals.studentSpouseContribution ?? 0,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,13 @@ export interface StudentAssessmentDetail {
id: number;
originalAssessmentStudyStartDate: Date;
}

/**
* Full time program year student contribution for calculating program year totals.
*/
export enum FullTimeStudentContributionType {
ScholarshipBursaries = "ScholarshipBursaries",
SpouseContributionWeeks = "SpouseContributionWeeks",
FederalFSC = "FederalFSC",
ProvincialFSC = "ProvincialFSC",
}

0 comments on commit 4873ee4

Please sign in to comment.