Skip to content

Commit

Permalink
Merge pull request #235 from icefoganalytics/test
Browse files Browse the repository at this point in the history
Update nars-v17-reporting-service.ts
  • Loading branch information
datajohnson authored Jan 13, 2024
2 parents 280e3e9 + 0a8a7ad commit 52e55d5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/api/services/admin/nars-v17-reporting-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ async function calculateFamilySize(
family.narsCatCode = "3";
}

// Married / Common Law or Single Parent
if ([3, 4].includes(classification)) {
let deps = await db("sfa.dependent")
.innerJoin("sfa.dependent_eligibility", "dependent.id", "dependent_eligibility.dependent_id")
Expand All @@ -513,7 +514,9 @@ async function calculateFamilySize(
family.post_secondary = deps.filter((f: any) => f.is_post_secondary).length;

family.family_size = classification == 3 ? 2 + family.csl_dependants : 1 + family.csl_dependants;
} else if (classification == 1) {
}
// Single Dependent
else if (classification == 1) {
let parentDeps = await db("sfa.parent_dependent")
.innerJoin("sfa.application", "application.id", "parent_dependent.application_id")
.select("parent_dependent.*")
Expand All @@ -530,7 +533,9 @@ async function calculateFamilySize(
family.post_secondary = parentDeps.filter((f: any) => f.is_attend_post_secondary).length + 1;
family.family_size = 1 + parentDeps.length + (hasParent1 ? 1 : 0) + (hasParent2 ? 1 : 0);

family.under12_or_disabled = parentDeps.filter((f: any) => f.age < 11 || f.is_disabled).length;
family.under12_or_disabled = parentDeps.filter(
(f: any) => f.is_csl_eligible && (f.age < 11 || f.is_disabled)
).length;
family.over11 = parentDeps.filter((f: any) => f.is_csl_eligible && f.age >= 12).length;
} else {
family.family_size = 1;
Expand Down

0 comments on commit 52e55d5

Please sign in to comment.