From dc9f43e7f672a05f837bc9d6e3bc6e25c6caad8d Mon Sep 17 00:00:00 2001 From: Michael Johnson Date: Mon, 18 Sep 2023 16:18:37 -0700 Subject: [PATCH 1/3] Change eCert Filter --- db/4_functions.sql | 3 +-- src/api/repositories/disbursement/disbursement-repository.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/db/4_functions.sql b/db/4_functions.sql index 2e497346..5c51e853 100644 --- a/db/4_functions.sql +++ b/db/4_functions.sql @@ -4023,8 +4023,7 @@ BEGIN INNER JOIN sfa.assessment a ON fr.id = a.funding_request_id INNER JOIN sfa.disbursement d ON a.id = d.assessment_id INNER JOIN sfa.person p ON p.id = s.person_id - LEFT JOIN sfa.person_address pa ON pa.person_id = p.id AND pa.address_type_id = 1 - LEFT JOIN sfa.person_address pam ON pa.person_id = p.id AND pa.address_type_id = 2 + LEFT JOIN sfa.person_address pa ON pa.person_id = p.id AND pa.id = app.primary_address_id LEFT JOIN sfa.msfaa m ON s.id = m.student_id WHERE fr.request_type_id IN (4, 5) AND d.csl_cert_seq_number = @CSL_CERT_SEQ_P diff --git a/src/api/repositories/disbursement/disbursement-repository.ts b/src/api/repositories/disbursement/disbursement-repository.ts index 700b3455..e4490d97 100644 --- a/src/api/repositories/disbursement/disbursement-repository.ts +++ b/src/api/repositories/disbursement/disbursement-repository.ts @@ -56,7 +56,7 @@ export class DisbursementRepository extends BaseRepository implements IMainTable "*" ) .where({ assessment_id: assessment_id }) - .whereNull("financial_batch_id") + .whereNotNull("csl_cert_seq_number") .orderBy("id", "asc"); query.forEach((x: DisbursementDTO) => result.push(x)); From 29765588bcd59824fb5bdb30204ec0b2c165b2c7 Mon Sep 17 00:00:00 2001 From: Michael Johnson Date: Mon, 18 Sep 2023 16:18:54 -0700 Subject: [PATCH 2/3] Reformat --- .../disbursement/disbursement-repository.ts | 214 +++++++++--------- 1 file changed, 104 insertions(+), 110 deletions(-) diff --git a/src/api/repositories/disbursement/disbursement-repository.ts b/src/api/repositories/disbursement/disbursement-repository.ts index e4490d97..4f4b90da 100644 --- a/src/api/repositories/disbursement/disbursement-repository.ts +++ b/src/api/repositories/disbursement/disbursement-repository.ts @@ -5,146 +5,140 @@ import { IMainTable } from "../i-main-table"; import { PortalStatusDTO } from "models/dto/PortalStatusDTO"; export class DisbursementRepository extends BaseRepository implements IMainTable { + protected mainTable: string = "sfa.disbursement"; + + private disbursement: Partial = {}; + + constructor(maindb: Knex) { + super(maindb); + } + + getMainTable(): string { + return this.mainTable; + } + + getDisbursementTable(disbursement: DisbursementDTO): DisbursementTable { + return Object.keys(disbursement) + .filter((key) => disbursementColumns.includes(key as keyof DisbursementTable)) + .reduce((obj: any, key) => { + obj[key as keyof DisbursementTable] = disbursement[key as keyof DisbursementTable]; + return obj as DisbursementTable; + }, {}); + } + + async getByAssessmentId(assessment_id: number | undefined): Promise>> { + let result: Array> = []; + + if (assessment_id) { + const query = await this.mainDb(this.mainTable) + .select("*") + .where({ assessment_id: assessment_id }) + .orderBy("id", "asc"); + + query.forEach((x: DisbursementDTO) => { + x.delete_flag = false; + result.push(x); + }); + } - protected mainTable: string = "sfa.disbursement"; - - private disbursement: Partial = {}; + return result; + } - constructor(maindb: Knex) { - super(maindb); - } + async getECertificateList(assessment_id: number | undefined): Promise>> { + let result: Array> = []; - getMainTable(): string { - return this.mainTable; - } + if (assessment_id) { + const query = await this.mainDb(this.mainTable) + .select("*") + .where({ assessment_id: assessment_id }) + .whereNotNull("csl_cert_seq_number") + .orderBy("id", "asc"); - getDisbursementTable(disbursement: DisbursementDTO): DisbursementTable { - return Object.keys(disbursement) - .filter(key => disbursementColumns.includes(key as keyof DisbursementTable)) - .reduce((obj: any, key) => { - obj[key as keyof DisbursementTable] = disbursement[key as keyof DisbursementTable]; - return obj as DisbursementTable; - }, {}); + query.forEach((x: DisbursementDTO) => result.push(x)); } - async getByAssessmentId(assessment_id: number | undefined): Promise>> { - let result: Array> = []; - - if (assessment_id) { - const query = await this.mainDb(this.mainTable) - .select( - "*" - ) - .where({ assessment_id: assessment_id }) - .orderBy("id", "asc"); - - query.forEach((x: DisbursementDTO) => { - x.delete_flag = false; - result.push(x); - }); - } - - return result; - } + return result; + } - async getECertificateList(assessment_id: number | undefined): Promise>> { - let result: Array> = []; - - if (assessment_id) { - const query = await this.mainDb(this.mainTable) - .select( - "*" - ) - .where({ assessment_id: assessment_id }) - .whereNotNull("csl_cert_seq_number") - .orderBy("id", "asc"); - - query.forEach((x: DisbursementDTO) => result.push(x)); - } - - return result; - } + async getPortalStatusList(): Promise>> { + let result: Array> = []; - async getPortalStatusList(): Promise>> { - let result: Array> = []; - - const query = await this.mainDb("sfa.portal_status") - .select( - "*" - ) - .orderBy("id", "asc"); - - query.forEach((x: PortalStatusDTO) => result.push(x)); - - return result; - } + const query = await this.mainDb("sfa.portal_status").select("*").orderBy("id", "asc"); + + query.forEach((x: PortalStatusDTO) => result.push(x)); - async getTotalGrantAmount(application_id?: number): Promise { - let result = 0; + return result; + } - if (application_id) { - result = await this.getScalarValue("fn_get_total_grant_amount", [application_id]); - } + async getTotalGrantAmount(application_id?: number): Promise { + let result = 0; - return result; + if (application_id) { + result = await this.getScalarValue("fn_get_total_grant_amount", [application_id]); } - async getGrantAmount(application_id?: number, request_type_id?: number): Promise { - let result = 0; + return result; + } - if (application_id && request_type_id) { - result = await this.getScalarValue("fn_get_grant_amount", [application_id, request_type_id]); - } + async getGrantAmount(application_id?: number, request_type_id?: number): Promise { + let result = 0; - return result; + if (application_id && request_type_id) { + result = await this.getScalarValue("fn_get_grant_amount", [application_id, request_type_id]); } - async getDisbursedAmount(funding_request_id?: number, assessment_id?: number): Promise { - let result = 0; + return result; + } - if (funding_request_id && assessment_id) { - result = await this.getScalarValue("fn_get_disbursed_amount_fct", [funding_request_id, assessment_id]); - } + async getDisbursedAmount(funding_request_id?: number, assessment_id?: number): Promise { + let result = 0; - return result; + if (funding_request_id && assessment_id) { + result = await this.getScalarValue("fn_get_disbursed_amount_fct", [funding_request_id, assessment_id]); } - async getPreviousDisbursedAmount(funding_request_id?: number, assessment_id?: number): Promise { - let result = 0; + return result; + } - if (funding_request_id && assessment_id) { - result = await this.getScalarValue("fn_get_previous_disbursed_amount", [funding_request_id, assessment_id]); - } + async getPreviousDisbursedAmount(funding_request_id?: number, assessment_id?: number): Promise { + let result = 0; - return result; + if (funding_request_id && assessment_id) { + result = await this.getScalarValue("fn_get_previous_disbursed_amount", [ + funding_request_id, + assessment_id, + ]); } - async getMaxTransaction(funding_request_id?: number): Promise { - let result = 0; + return result; + } - if (funding_request_id) { - result = await this.getScalarValue("fn_get_disbursement_max_transaction", [funding_request_id]); - } + async getMaxTransaction(funding_request_id?: number): Promise { + let result = 0; - return result.toString(); + if (funding_request_id) { + result = await this.getScalarValue("fn_get_disbursement_max_transaction", [funding_request_id]); } - async getNextTransactionSequenceValue(): Promise { - const query = await this.mainDb.raw("SELECT NEXT VALUE FOR sfa.CSL_TRANSACTION_SEQ as nextVal;"); - const result: Partial<{ nextVal?: number }> = this.singleResult(query); - return result.nextVal?.toString() ?? '0'; - } + return result.toString(); + } - async getTopDisbursements(application_id?: number): Promise>> { - let result: Array> = []; + async getNextTransactionSequenceValue(): Promise { + const query = await this.mainDb.raw("SELECT NEXT VALUE FOR sfa.CSL_TRANSACTION_SEQ as nextVal;"); + const result: Partial<{ nextVal?: number }> = this.singleResult(query); + return result.nextVal?.toString() ?? "0"; + } - if (application_id) { - result = await this.mainDb.raw(`SELECT * FROM sfa.fn_get_top_disbursements(${application_id})`); - if (!Array.isArray(result)) { - result = []; - } - } + async getTopDisbursements(application_id?: number): Promise>> { + let result: Array> = []; - return result; + if (application_id) { + result = await this.mainDb.raw(`SELECT * FROM sfa.fn_get_top_disbursements(${application_id})`); + if (!Array.isArray(result)) { + result = []; + } } -} \ No newline at end of file + + return result; + } +} From 0755264d02d9b17715e08f2d39bbabe693382c6b Mon Sep 17 00:00:00 2001 From: Michael Johnson Date: Mon, 18 Sep 2023 16:19:58 -0700 Subject: [PATCH 3/3] Spelling --- .../csfa-needs-assessment/CSLFT-detail/CSLFTMSFAA.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/web/src/components/application/csfa-needs-assessment/CSLFT-detail/CSLFTMSFAA.vue b/src/web/src/components/application/csfa-needs-assessment/CSLFT-detail/CSLFTMSFAA.vue index eb27e9cc..a6952152 100644 --- a/src/web/src/components/application/csfa-needs-assessment/CSLFT-detail/CSLFTMSFAA.vue +++ b/src/web/src/components/application/csfa-needs-assessment/CSLFT-detail/CSLFTMSFAA.vue @@ -130,7 +130,7 @@ E-Certificate
-

Cart #

+

Cert #

Sent Date