Skip to content

Commit 6cb7ac9

Browse files
authored
Merge pull request #385 from icefoganalytics/test
NARS Fixes
2 parents 97c37ab + 08a1e97 commit 6cb7ac9

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

src/api/services/admin/nars-dis-reporting-service.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class NarsDisabilityReportingService {
4848
INNER JOIN sfa.assessment ON (funding_request.id = assessment.funding_request_id)
4949
INNER JOIN sfa.institution_campus ON (application.institution_campus_id = institution_campus.id)
5050
INNER JOIN sfa.institution ON (institution.id = institution_campus.institution_id)
51-
INNER JOIN (SELECT SUM(COALESCE(disbursed_amount, 0)) disbursed, max(issue_date) issue_date, funding_request_id, assessment_id
51+
LEFT JOIN (SELECT SUM(COALESCE(disbursed_amount, 0)) disbursed, max(issue_date) issue_date, funding_request_id, assessment_id
5252
FROM sfa.disbursement GROUP BY assessment_id, funding_request_id) d ON (funding_request.id = d.funding_request_id and assessment.id = d.assessment_id)
5353
INNER JOIN (SELECT funding_request_id, MAX(id) last_id FROM sfa.assessment GROUP BY funding_request_id) maxid ON assessment.id = maxid.last_id
5454
where
@@ -270,13 +270,19 @@ function getCodeForService(service: number): number {
270270
return 6;
271271
case 6:
272272
return 7;
273+
case 10:
274+
return 1;
275+
case 9:
276+
return 19;
273277
default:
274278
return 8;
275279
}
276280
}
277281
function getCodeForEqipment(equipment: number): number {
278282
switch (equipment) {
279283
case 1:
284+
return 12;
285+
case 9:
280286
return 13;
281287
case 2:
282288
return 20;
@@ -288,6 +294,12 @@ function getCodeForEqipment(equipment: number): number {
288294
return 21;
289295
case 6:
290296
return 16;
297+
case 10:
298+
return 14;
299+
case 11:
300+
return 17;
301+
case 12:
302+
return 15;
291303
default:
292304
return 11;
293305
}

src/api/services/admin/nars-disft-reporting-service.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ export class NarsDisabilityRCLReportingService {
123123
row.push(new Column("sin", app.sin, " ", 9));
124124
row.push(new Column("prov_issue", "YT", " ", 2));
125125
row.push(new Column("dob", moment.utc(app.birth_date).format("YYYYMMDD"), " ", 8));
126-
row.push(new Column("gender", app.sex_id == 1 ? "M" : app.sex_id == 2 ? "F" : "U", " ", 1));
126+
row.push(
127+
new Column("gender", app.sex_id == 1 ? "M" : app.sex_id == 2 ? "F" : app.sex_id == -1 ? "O" : "U", " ", 1)
128+
);
127129
row.push(new Column("cat_code", cat_code, " ", 1));
128130
row.push(new Column("ei_code", app.institution_code, " ", 4));
129131
row.push(new Column("fos", app.field_program_code, " ", 2));

src/api/services/admin/nars-v17-2-reporting-service.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,14 @@ export class NarsV17_2ReportingService {
181181
.groupBy("request_type_id")
182182
.sum("disbursed_amount as disbursed_amount");
183183

184-
let ftLoan = otherFunds.find((f) => f.request_type_id == 4);
184+
let otherFunds2 = await db("sfa.funding_request")
185+
.where({ application_id: applicationId, assessment_id: app.id })
186+
.join("sfa.disbursement", "disbursement.funding_request_id", "funding_request.id")
187+
.select("request_type_id")
188+
.groupBy("request_type_id")
189+
.sum("disbursed_amount as disbursed_amount");
190+
191+
let ftLoan = otherFunds2.find((f) => f.request_type_id == 4);
185192
let ftGrant = otherFunds.find((f) => f.request_type_id == 35);
186193
let ftDepGrant = otherFunds.find((f) => f.request_type_id == 32);
187194
let disGrant = otherFunds.find((f) => f.request_type_id == 29);
@@ -275,7 +282,7 @@ export class NarsV17_2ReportingService {
275282
row.push(new Column("app_status", app_status, " ", 1));
276283

277284
row.push(new Column("assess_date", moment.utc(app.assessed_date).format("YYYYMMDD"), " ", 8));
278-
row.push(new Column("reasess_indicator", app.assessment_type_id == 1 ? "0" : "4", " ", 1));
285+
row.push(new Column("reasess_indicator", app.assessment_type_id == 1 ? "0" : "8", " ", 1));
279286
row.push(new Column("csl_auth_date", moment.utc(app.assessed_date).format("YYYYMMDD"), " ", 8));
280287

281288
row.push(new Column("sin", app.sin, " ", 9));

0 commit comments

Comments
 (0)