Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIMSBIOHUB-24: First Nations as a funding source on projects/ surveys #1026

Merged
merged 62 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
354cc68
- expanded project funding to first nations
cgarrettjones Apr 17, 2023
c0c3386
- adjust project funding source data integrity trigger
cgarrettjones Apr 17, 2023
a7515e1
Merge branch 'dev' into BHBC-2297
KjartanE Apr 17, 2023
73d51e1
updated funding forms to account for item type
AlfredRosenthal Apr 27, 2023
a5b8896
added array extension
AlfredRosenthal Apr 27, 2023
0132e29
got first nations information displaying
AlfredRosenthal Apr 27, 2023
c114b08
wip
AlfredRosenthal Apr 27, 2023
4e901c3
Merge branch 'dev' into SIMSBIOHUB-24
AlfredRosenthal Apr 27, 2023
a1f3723
removed old select
AlfredRosenthal Apr 28, 2023
002f41a
added more console logs
AlfredRosenthal Apr 28, 2023
64f2af2
fixed validation issue
AlfredRosenthal Apr 28, 2023
d471738
formik form validating now
AlfredRosenthal Apr 28, 2023
44cc080
updating SQL and open API docs for first nations data
AlfredRosenthal May 1, 2023
90ff39b
Merge branch 'dev' into SIMSBIOHUB-24
AlfredRosenthal May 1, 2023
ddb0af5
fixed API and display for first nations data
AlfredRosenthal May 1, 2023
d9e4492
clean up
AlfredRosenthal May 1, 2023
75add2f
added autcomplete field back
AlfredRosenthal May 1, 2023
a1a414f
clean up
AlfredRosenthal May 1, 2023
25440b4
clean up
AlfredRosenthal May 1, 2023
7baa31a
prepping update for projects
AlfredRosenthal May 1, 2023
6ccfe5b
cleaning up, started zod
AlfredRosenthal May 2, 2023
952f792
working form
AlfredRosenthal May 2, 2023
fb1258f
fixed bug with saving investment actions
AlfredRosenthal May 2, 2023
b1069e5
clean up
AlfredRosenthal May 2, 2023
91fae26
fixed project save, got surveys showing proper funding sources
AlfredRosenthal May 3, 2023
1f8033e
survey setup to edit/ create with new funding sources
AlfredRosenthal May 3, 2023
ffdc9af
fixed validation for yup schema
AlfredRosenthal May 3, 2023
4ec0672
ran fix, cleaned up console logs
AlfredRosenthal May 4, 2023
5761623
squashing warnings
AlfredRosenthal May 4, 2023
79fb463
removal
AlfredRosenthal May 4, 2023
f80069f
clean up
AlfredRosenthal May 4, 2023
2851ed6
fixed broken api tests
AlfredRosenthal May 4, 2023
ae568ac
added new generic funding source component
AlfredRosenthal May 4, 2023
8ab1e01
fixed various tests
AlfredRosenthal May 4, 2023
5cf1d15
updated to use new funding source component
AlfredRosenthal May 4, 2023
212114f
Merge branch 'dev' into SIMSBIOHUB-24
AlfredRosenthal May 4, 2023
7ec6f29
fixed investment action not showing on survey
AlfredRosenthal May 4, 2023
ebba6a0
fixed sonar bugs
AlfredRosenthal May 4, 2023
eceeaad
fixed
AlfredRosenthal May 4, 2023
bb85f16
ignore-skip
AlfredRosenthal May 4, 2023
38c6c7b
sonar cloud smells
AlfredRosenthal May 4, 2023
5bbad61
fixing sonar cloud smells
AlfredRosenthal May 4, 2023
70c76cd
fixed code smells project repository
AlfredRosenthal May 4, 2023
be8b97a
washing more sonar smells
AlfredRosenthal May 4, 2023
a73f264
cleaned up sonar code smells
AlfredRosenthal May 4, 2023
ced51d2
one more code smell
AlfredRosenthal May 4, 2023
7e8acf2
fixed some tests
AlfredRosenthal May 5, 2023
a4a7fee
updated function, ran fix
AlfredRosenthal May 5, 2023
3042cbc
fixed smell
AlfredRosenthal May 5, 2023
596cb6b
fixed an issue with autocomplete state
AlfredRosenthal May 5, 2023
253b91f
Add migration to fix first nations band names
NickPhura May 5, 2023
97fd434
Merge branch 'SIMSBIOHUB-24' of https://github.com/bcgov/biohubbc int…
AlfredRosenthal May 5, 2023
093d8a5
moved component out, refined funding source auto complete
AlfredRosenthal May 8, 2023
cf15eae
renamed funding source file
AlfredRosenthal May 8, 2023
3b5e642
adding comments for clarity
AlfredRosenthal May 8, 2023
4b694db
fixed code smell
AlfredRosenthal May 8, 2023
8cd243e
updated alphabetize function
AlfredRosenthal May 8, 2023
89c124e
added more comprehensive open APR spec for funding sources
AlfredRosenthal May 9, 2023
ff4a6a5
ran fix
AlfredRosenthal May 9, 2023
b51d879
Merge branch 'dev' into SIMSBIOHUB-24
AlfredRosenthal May 9, 2023
e3a7ed8
Merge branch 'dev' into SIMSBIOHUB-24
AlfredRosenthal May 9, 2023
7a7fb79
Merge branch 'dev' into SIMSBIOHUB-24
AlfredRosenthal May 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions api/src/models/project-create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ describe('PostLocationData', () => {
});

it('sets location_description', function () {
expect(projectLocationData.location_description).to.equal(null);
expect(projectLocationData.location_description).to.be.undefined;
});

it('sets geometry', function () {
Expand Down Expand Up @@ -570,7 +570,8 @@ describe('PostFundingData', () => {
agency_project_id: 'agency project id',
funding_amount: 12,
start_date: '2020/04/03',
end_date: '2020/05/05'
end_date: '2020/05/05',
first_nations_id: null
}
]
};
Expand Down
7 changes: 5 additions & 2 deletions api/src/models/project-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export class PostLocationData {
}
});

this.location_description = (obj && obj.location_description) || null;
this.location_description = obj?.location_description;
this.geometry = (obj?.geometry?.length && obj.geometry) || [];
}
}
Expand Down Expand Up @@ -166,12 +166,14 @@ export class PostIUCNData {
* @class PostFundingSource
*/
export class PostFundingSource {
agency_id: number;
id?: number;
agency_id?: number;
investment_action_category: number;
agency_project_id: string;
funding_amount: number;
start_date: string;
end_date: string;
first_nations_id?: number;

constructor(obj?: any) {
defaultLog.debug({ label: 'PostFundingSource', message: 'params', obj });
Expand All @@ -182,6 +184,7 @@ export class PostFundingSource {
this.funding_amount = obj?.funding_amount || null;
this.start_date = obj?.start_date || null;
this.end_date = obj?.end_date || null;
this.first_nations_id = obj?.first_nations_id || null;
}
}

Expand Down
2 changes: 1 addition & 1 deletion api/src/models/project-update.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ describe('PutLocationData', () => {
});

it('sets location_description', () => {
expect(data.location_description).to.equal(null);
expect(data.location_description).to.undefined;
});

it('sets geometry', () => {
Expand Down
12 changes: 7 additions & 5 deletions api/src/models/project-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class PutLocationData {
}
});

this.location_description = (obj && obj.location_description) || null;
this.location_description = obj?.location_description;
this.geometry = (obj?.geometry?.length && obj.geometry) || [];
this.revision_count = obj?.revision_count ?? null;
}
Expand Down Expand Up @@ -106,13 +106,14 @@ export class PutIUCNData {
}

export class PutFundingSource {
id: number;
investment_action_category: number;
agency_project_id: string;
funding_amount: number;
id?: number;
investment_action_category?: number;
agency_project_id?: string;
funding_amount?: number;
start_date: string;
end_date: string;
revision_count: number;
first_nations_id?: number;

constructor(obj?: any) {
defaultLog.debug({ label: 'PutFundingSource', message: 'params', obj });
Expand All @@ -124,6 +125,7 @@ export class PutFundingSource {
this.start_date = obj?.start_date || null;
this.end_date = obj?.end_date || null;
this.revision_count = obj?.revision_count ?? null;
this.first_nations_id = obj?.first_nations_id ?? null;
}
}

Expand Down
4 changes: 3 additions & 1 deletion api/src/models/project-view.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,9 @@ describe('GetFundingData', () => {
start_date: Date.now().toString(),
end_date: Date.now().toString(),
agency_project_id: '12',
revision_count: 1
revision_count: 1,
first_nations_name: null,
first_nations_id: null
}
];

Expand Down
63 changes: 31 additions & 32 deletions api/src/models/project-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ export class GetProjectData {
this.end_date = projectData?.end_date || '';
this.comments = projectData?.comments || '';
this.completion_status =
(projectData &&
projectData.end_date &&
(projectData?.end_date &&
moment(projectData.end_date).endOf('day').isBefore(moment()) &&
COMPLETION_STATUS.COMPLETED) ||
COMPLETION_STATUS.ACTIVE;
Expand Down Expand Up @@ -104,7 +103,7 @@ export class GetLocationData {
revision_count: number;

constructor(locationData?: any) {
const locationDataItem = locationData && locationData.length && locationData[0];
const locationDataItem = locationData?.length && locationData[0];

this.location_description = locationDataItem?.location_description || '';
this.geometry = (locationDataItem?.geometry?.length && locationDataItem.geometry) || [];
Expand All @@ -129,28 +128,28 @@ export class GetIUCNClassificationData {

constructor(iucnClassificationData?: any[]) {
this.classificationDetails =
(iucnClassificationData &&
iucnClassificationData.map((item: any) => {
return {
classification: item.classification,
subClassification1: item.subclassification1,
subClassification2: item.subclassification2
};
})) ||
[];
iucnClassificationData?.map((item: any) => {
return {
classification: item.classification,
subClassification1: item.subclassification1,
subClassification2: item.subclassification2
};
}) ?? [];
}
}

interface IGetFundingSource {
id: number;
agency_id: number;
investment_action_category: number;
investment_action_category_name: string;
agency_id?: number;
investment_action_category?: number;
investment_action_category_name?: string;
agency_name: string;
funding_amount: number;
funding_amount?: number;
start_date: string;
end_date: string;
agency_project_id: string;
first_nations_id?: number;
first_nations_name?: string;
revision_count: number;
}

Expand All @@ -159,22 +158,22 @@ export class GetFundingData {

constructor(fundingData?: any[]) {
this.fundingSources =
(fundingData &&
fundingData.map((item: any) => {
return {
id: item.id,
agency_id: item.agency_id,
investment_action_category: item.investment_action_category,
investment_action_category_name: item.investment_action_category_name,
agency_name: item.agency_name,
funding_amount: item.funding_amount,
start_date: item.start_date,
end_date: item.end_date,
agency_project_id: item.agency_project_id,
revision_count: item.revision_count
};
})) ||
[];
fundingData?.map((item: any) => {
return {
id: item.id,
agency_id: item.agency_id,
investment_action_category: item.investment_action_category,
investment_action_category_name: item.investment_action_category_name,
agency_name: item.agency_name,
funding_amount: item.funding_amount,
start_date: item.start_date,
end_date: item.end_date,
agency_project_id: item.agency_project_id,
revision_count: item.revision_count,
first_nations_id: item.first_nations_id,
first_nations_name: item.first_nations_name
};
}) ?? [];
}
}

Expand Down
16 changes: 12 additions & 4 deletions api/src/models/survey-view.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,9 @@ describe('GetSurveyFundingSources', () => {
investment_action_category_id: 4,
investment_action_category_name: 'name11',
agency_name: 'name1',
funding_source_project_id: '5'
funding_source_project_id: '5',
first_nations_id: null,
first_nations_name: null
},
{
project_funding_source_id: 6,
Expand All @@ -251,7 +253,9 @@ describe('GetSurveyFundingSources', () => {
investment_action_category_id: 9,
investment_action_category_name: 'name22',
agency_name: 'name2',
funding_source_project_id: '10'
funding_source_project_id: '10',
first_nations_id: null,
first_nations_name: null
}
];

Expand All @@ -270,7 +274,9 @@ describe('GetSurveyFundingSources', () => {
investment_action_category_id: 4,
investment_action_category_name: 'name11',
agency_name: 'name1',
funding_source_project_id: '5'
funding_source_project_id: '5',
first_nations_id: null,
first_nations_name: null
},
{
pfs_id: 6,
Expand All @@ -281,7 +287,9 @@ describe('GetSurveyFundingSources', () => {
investment_action_category_id: 9,
investment_action_category_name: 'name22',
agency_name: 'name2',
funding_source_project_id: '10'
funding_source_project_id: '10',
first_nations_id: null,
first_nations_name: null
}
]);
});
Expand Down
42 changes: 22 additions & 20 deletions api/src/models/survey-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class GetPermitData {
permit_id: item.permit_id,
permit_number: item.number,
permit_type: item.type
})) || [];
})) ?? [];
}
}

Expand All @@ -108,36 +108,38 @@ export class GetSurveyPurposeAndMethodologyData {

interface IGetSurveyFundingSource {
pfs_id: number;
funding_amount: number;
funding_amount?: number;
funding_source_id: number;
funding_start_date: string;
funding_end_date: string;
investment_action_category_id: number;
investment_action_category_name: string;
agency_name: string;
investment_action_category_id?: number;
investment_action_category_name?: string;
agency_name?: string;
funding_source_project_id: string;
first_nations_id?: number;
first_nations_name?: string;
}

export class GetSurveyFundingSources {
funding_sources: IGetSurveyFundingSource[];

constructor(obj?: any[]) {
this.funding_sources =
(obj &&
obj.map((item: any) => {
return {
pfs_id: item.project_funding_source_id,
funding_amount: item.funding_amount,
funding_source_id: item.funding_source_id,
funding_start_date: item.funding_start_date,
funding_end_date: item.funding_end_date,
investment_action_category_id: item.investment_action_category_id,
investment_action_category_name: item.investment_action_category_name,
agency_name: item.agency_name,
funding_source_project_id: item.funding_source_project_id
};
})) ||
[];
obj?.map((item: any) => {
return {
pfs_id: item.project_funding_source_id,
funding_amount: item.funding_amount,
funding_source_id: item.funding_source_id,
funding_start_date: item.funding_start_date,
funding_end_date: item.funding_end_date,
investment_action_category_id: item.investment_action_category_id,
investment_action_category_name: item.investment_action_category_name,
agency_name: item.agency_name,
funding_source_project_id: item.funding_source_project_id,
first_nations_id: item.first_nations_id,
first_nations_name: item.first_nations_name
};
}) ?? [];
}
}

Expand Down
Loading