From d2db540d15f3d200d1faa638c2241d3ce1dca92c Mon Sep 17 00:00:00 2001 From: Jerry Wang Date: Wed, 15 May 2024 14:24:55 -0700 Subject: [PATCH 1/6] 538-raw-data-download --- api/src/application/application.service.ts | 6 +++-- api/src/score/ro/raw-data.ro.ts | 28 +++++++++------------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/api/src/application/application.service.ts b/api/src/application/application.service.ts index 53eb38f..c5fd4e7 100644 --- a/api/src/application/application.service.ts +++ b/api/src/application/application.service.ts @@ -270,15 +270,16 @@ export class ApplicationService { } async getRawData(): Promise { - const applicationsRaw = await this.getApplicationsRawData(); + const applicationsRaw = await this.getApplicationsRawData(); return new RawDataRo(applicationsRaw).result; } async getApplicationsRawData(): Promise { // done this way to remove the submission object from response - return this.applicationRepository + return this.applicationViewRepository .createQueryBuilder('a') .select([ + 'a.fundingYear', 'a.applicantName', 'a.asks', 'a.confirmationId', @@ -298,6 +299,7 @@ export class ApplicationService { .where('status.name NOT ILIKE :rejectedStatus', { rejectedStatus: `%${ApplicationStatus.DENIED}%`, }) + .orderBy('a.fundingYear', 'DESC', 'NULLS LAST') .getMany(); } } diff --git a/api/src/score/ro/raw-data.ro.ts b/api/src/score/ro/raw-data.ro.ts index dce8938..27a7439 100644 --- a/api/src/score/ro/raw-data.ro.ts +++ b/api/src/score/ro/raw-data.ro.ts @@ -120,10 +120,10 @@ export class RawDataRo { return item.workshopScores && item.workshopScores.length > 0; }; - const getFundingYear = (signedDate: any) => { - if (!signedDate) return NO_VALUE; - return `${dayjs(signedDate).format('YY')}/${dayjs(signedDate).add(1, 'year').format('YY')}`; - }; + // const getFundingYear = (signedDate: any) => { + // if (!signedDate) return NO_VALUE; + // return `${dayjs(signedDate).format('YY')}/${dayjs(signedDate).add(1, 'year').format('YY')}`; + // }; const checkGovernmentApplicant = (primaryApplicant: string, secondaryApplicant: string) => { const YES = 'Y'; @@ -154,7 +154,7 @@ export class RawDataRo { eligibility: checkIfItemHasWorkshopScore(item) ? item.workshopScores[0].data?.eligibilityScore : NO_VALUE, - fundingYear: getFundingYear(submission?.s10Container?.s10ProjectMangerApproverDate), + fundingYear: submission?.s1Container?.s1FundingYear, applicantName: item.applicantName, indigenousGovernment: checkGovernmentApplicant( submission.s1Container?.s1GovernmentType, @@ -200,10 +200,10 @@ export class RawDataRo { return dayjs(itemDate).isValid() ? dayjs(itemDate).format('YYYY-MM-DD') : NO_VALUE; }; - const getFundingYear = (signedDate: any) => { - if (!signedDate) return NO_VALUE; - return `${dayjs(signedDate).format('YY')}/${dayjs(signedDate).add(1, 'year').format('YY')}`; - }; + // const getFundingYear = (signedDate: any) => { + // if (!signedDate) return NO_VALUE; + // return `${dayjs(signedDate).format('YY')}/${dayjs(signedDate).add(1, 'year').format('YY')}`; + // }; for (const item of data) { if (item.applicationType?.name === ApplicationType.NETWORK_FORM) continue; @@ -218,10 +218,7 @@ export class RawDataRo { submission.s4Container?.s4ProjectTitle || submission.s3Container?.s3ProjectTitle || NO_VALUE, - fundingYear: getFundingYear( - submission.s10Container?.s10ProjectMangerApproverDate || - submission.s11Container?.s11ProjectMangerApproverDate - ), + fundingYear: submission.s1Container?.s1FundingYear, usageCountDate: NO_VALUE, usageCountTime: NO_VALUE, usageCountLocation: NO_VALUE, @@ -241,10 +238,7 @@ export class RawDataRo { submission.s4Container?.s4ProjectTitle || submission.s3Container?.s3ProjectTitle || NO_VALUE, - fundingYear: getFundingYear( - submission.s10Container?.s10ProjectMangerApproverDate || - submission.s11Container?.s11ProjectMangerApproverDate - ), + fundingYear: row.fundingYear, usageCountDate: formatDate(row.dateCell), usageCountTime: row.countPeriodCell || NO_VALUE, usageCountLocation: row.stationLocationCell || NO_VALUE, From a2afcb6702738ccef1a7aa7d012d98f04e8c838f Mon Sep 17 00:00:00 2001 From: Jerry Wang Date: Thu, 16 May 2024 09:28:44 -0700 Subject: [PATCH 2/6] form score validation --- client/components/application/BroaderReview.tsx | 1 + client/components/broader-review/Input.tsx | 8 ++++++++ client/constants/validation.ts | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/client/components/application/BroaderReview.tsx b/client/components/application/BroaderReview.tsx index e6f37cf..5a34d7f 100644 --- a/client/components/application/BroaderReview.tsx +++ b/client/components/application/BroaderReview.tsx @@ -123,6 +123,7 @@ export const BroaderReview: React.FC = ({ label={item.label} name={item.name} tooltiptext={item.tooltiptext} + maxScore={item.maxScore} /> diff --git a/client/components/broader-review/Input.tsx b/client/components/broader-review/Input.tsx index acf3b65..6754360 100644 --- a/client/components/broader-review/Input.tsx +++ b/client/components/broader-review/Input.tsx @@ -16,6 +16,7 @@ export type InputProps = { name: string; secondaryList?: string[]; tooltiptext?: string; + maxScore?: number; }; export const Input: React.FC = ({ @@ -27,6 +28,7 @@ export const Input: React.FC = ({ name, secondaryList, tooltiptext, + maxScore, }) => { return (
@@ -44,6 +46,12 @@ export const Input: React.FC = ({
)} + {maxScore && !disabled && ( +
+ Max score: {maxScore} +
+ )} + {descriptionList && (
    {descriptionList.map((item: string, index: number) => { diff --git a/client/constants/validation.ts b/client/constants/validation.ts index a2f86bb..d835068 100644 --- a/client/constants/validation.ts +++ b/client/constants/validation.ts @@ -58,7 +58,7 @@ export const INFRASTRUCTURE_REVIEW_VALIDATION_SCHEMA = Yup.object().shape({ communityNeedsAndSafetyGuidelinesScore: Yup.number() .min(0, minValidationText + '0') - .max(15, maxValidationText + '15') + .max(10, maxValidationText + '10') .required('This field is required'), safetyScore: Yup.number() From d276d6384edaaaaa42d2f93d9d6c7aa4139d9546 Mon Sep 17 00:00:00 2001 From: Jerry Wang Date: Thu, 16 May 2024 09:32:56 -0700 Subject: [PATCH 3/6] format --- api/src/application/application.service.ts | 2 +- api/src/score/ro/raw-data.ro.ts | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/api/src/application/application.service.ts b/api/src/application/application.service.ts index c5fd4e7..7a06fca 100644 --- a/api/src/application/application.service.ts +++ b/api/src/application/application.service.ts @@ -270,7 +270,7 @@ export class ApplicationService { } async getRawData(): Promise { - const applicationsRaw = await this.getApplicationsRawData(); + const applicationsRaw = await this.getApplicationsRawData(); return new RawDataRo(applicationsRaw).result; } diff --git a/api/src/score/ro/raw-data.ro.ts b/api/src/score/ro/raw-data.ro.ts index 27a7439..0ff0407 100644 --- a/api/src/score/ro/raw-data.ro.ts +++ b/api/src/score/ro/raw-data.ro.ts @@ -120,11 +120,6 @@ export class RawDataRo { return item.workshopScores && item.workshopScores.length > 0; }; - // const getFundingYear = (signedDate: any) => { - // if (!signedDate) return NO_VALUE; - // return `${dayjs(signedDate).format('YY')}/${dayjs(signedDate).add(1, 'year').format('YY')}`; - // }; - const checkGovernmentApplicant = (primaryApplicant: string, secondaryApplicant: string) => { const YES = 'Y'; const NO = 'N'; @@ -200,11 +195,6 @@ export class RawDataRo { return dayjs(itemDate).isValid() ? dayjs(itemDate).format('YYYY-MM-DD') : NO_VALUE; }; - // const getFundingYear = (signedDate: any) => { - // if (!signedDate) return NO_VALUE; - // return `${dayjs(signedDate).format('YY')}/${dayjs(signedDate).add(1, 'year').format('YY')}`; - // }; - for (const item of data) { if (item.applicationType?.name === ApplicationType.NETWORK_FORM) continue; From 946274bffa23e8be234bceaa00298fd6724616fe Mon Sep 17 00:00:00 2001 From: Jerry Wang Date: Thu, 16 May 2024 09:35:23 -0700 Subject: [PATCH 4/6] change funding dropdown to input --- .../bcat-form-sections/application-dashboard.tsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/client/components/bcat-form-sections/application-dashboard.tsx b/client/components/bcat-form-sections/application-dashboard.tsx index b8c5ee7..e09b2fc 100644 --- a/client/components/bcat-form-sections/application-dashboard.tsx +++ b/client/components/bcat-form-sections/application-dashboard.tsx @@ -225,15 +225,10 @@ export const ApplicationDashboard: React.FC = () => {
    Filter By:
    - setState(p => ({ ...p, searchFundingYear: e.target.value }))} - options={[ - { name: '2024/25', value: '2024/25' }, - { name: '2025/26', value: '2025/26' }, - { name: '2026/27', value: '2026/27' }, - ]} /> Date: Thu, 16 May 2024 09:36:33 -0700 Subject: [PATCH 5/6] change funding dropdown to input --- api/src/application/application.service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/src/application/application.service.ts b/api/src/application/application.service.ts index 7a06fca..368bd72 100644 --- a/api/src/application/application.service.ts +++ b/api/src/application/application.service.ts @@ -90,7 +90,9 @@ export class ApplicationService { } if (query.fundingYear) { - queryBuilder.andWhere('app.fundingYear = :fundingYear', { fundingYear: query.fundingYear }); + queryBuilder.andWhere('app.fundingYear ILIKE :fundingYear', { + fundingYear: `%${query.fundingYear}%`, + }); } if (query.status) { From 468e8e6e10911dd27f716c98f7c4ab290fe3f7f0 Mon Sep 17 00:00:00 2001 From: Jerry Wang Date: Thu, 16 May 2024 09:38:16 -0700 Subject: [PATCH 6/6] change funding dropdown to input --- client/components/bcat-form-sections/application-dashboard.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/components/bcat-form-sections/application-dashboard.tsx b/client/components/bcat-form-sections/application-dashboard.tsx index e09b2fc..5b56480 100644 --- a/client/components/bcat-form-sections/application-dashboard.tsx +++ b/client/components/bcat-form-sections/application-dashboard.tsx @@ -153,7 +153,7 @@ export const ApplicationDashboard: React.FC = () => { searchAssignedTo.length === 0 && searchConfirmationID.length == 0 && searchTotalCost.length === 0 && - searchFundingYear == null && + searchFundingYear.length === 0 && searchStatus == null; return noValues;