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

Add fund status table to Data Dictionary with funding status descriptions #1507

Merged
merged 7 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions moped-database/metadata/tables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1767,18 +1767,21 @@
columns:
- funding_status_id
- funding_status_name
- funding_status_description
filter: {}
- role: moped-editor
permission:
columns:
- funding_status_id
- funding_status_name
- funding_status_description
filter: {}
- role: moped-viewer
permission:
columns:
- funding_status_id
- funding_status_name
- funding_status_description
filter: {}
- table:
name: moped_funds
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- Remove the funding_status_description column
ALTER TABLE "public"."moped_fund_status"
DROP COLUMN "funding_status_description";
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
ALTER TABLE "public"."moped_fund_status"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept this migration simple since it didn't seem like this table is a prereq for the db views that power the advanced search component on the Projects index page. Since fund status isn't an option as an advanced filter field, this seemed right, but I may be naive.

ADD COLUMN "funding_status_description" text NULL;

COMMENT ON COLUMN "public"."moped_fund_status"."funding_status_description" IS 'Description of the funding status';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇


UPDATE "public"."moped_fund_status"
SET "funding_status_description" = CASE "funding_status_name"
WHEN 'Tentative' THEN 'In conversation about possible funding commitment'
WHEN 'Confirmed' THEN 'Commitment to funding'
WHEN 'Available' THEN 'Funding is available, e.g. private developer'
WHEN 'Funding setup requested' THEN 'Requested that funding be set up in eCAPRIS'
WHEN 'Set up' THEN 'Funding has been set up in eCAPRIS; has FDU'
ELSE "funding_status_description"
END;
mddilley marked this conversation as resolved.
Show resolved Hide resolved
18 changes: 14 additions & 4 deletions moped-database/views/project_list_view.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,23 @@ CREATE OR REPLACE VIEW project_list_view AS WITH project_person_list_lookup AS (
funding_sources_lookup AS (
SELECT
mpf.project_id,
string_agg(DISTINCT mfs.funding_source_name, ', '::text ORDER BY mfs.funding_source_name) AS funding_source_name,
string_agg(DISTINCT mfp.funding_program_name, ', '::text ORDER BY mfp.funding_program_name) AS funding_program_names,
string_agg(
DISTINCT mfs.funding_source_name, ', '::text
ORDER BY mfs.funding_source_name
) AS funding_source_name,
string_agg(
DISTINCT mfp.funding_program_name, ', '::text
ORDER BY mfp.funding_program_name
) AS funding_program_names,
string_agg(
DISTINCT
CASE
WHEN mfs.funding_source_name IS NOT null AND mfp.funding_program_name IS NOT null THEN concat(mfs.funding_source_name, ' - ', mfp.funding_program_name)
WHEN mfs.funding_source_name IS NOT null THEN mfs.funding_source_name
WHEN mfp.funding_program_name IS NOT null THEN mfp.funding_program_name
ELSE null::text
END, ', '::text ORDER BY (
END, ', '::text
ORDER BY (
CASE
WHEN mfs.funding_source_name IS NOT null AND mfp.funding_program_name IS NOT null THEN concat(mfs.funding_source_name, ' - ', mfp.funding_program_name)
WHEN mfs.funding_source_name IS NOT null THEN mfs.funding_source_name
Expand Down Expand Up @@ -170,7 +177,10 @@ min_estimated_phase_dates AS (
project_component_work_types AS (
SELECT
mpc.project_id,
string_agg(DISTINCT mwt.name, ', '::text ORDER BY mwt.name) AS component_work_type_names
string_agg(
DISTINCT mwt.name, ', '::text
ORDER BY mwt.name
) AS component_work_type_names
FROM moped_proj_components mpc
LEFT JOIN moped_proj_component_work_types mpcwt ON mpcwt.project_component_id = mpc.project_component_id
LEFT JOIN moped_work_types mwt ON mwt.id = mpcwt.work_type_id
Expand Down
8 changes: 8 additions & 0 deletions moped-editor/src/queries/tableLookups.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,13 @@ export const TABLE_LOOKUPS_QUERY = gql`
project_role_name
project_role_description
}
moped_fund_status(
# Filter out the "Archived" status
where: { funding_status_id: { _neq: 0 } }
) {
funding_status_name
funding_status_id
funding_status_description
}
}
`;
18 changes: 18 additions & 0 deletions moped-editor/src/views/dev/LookupsView/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,24 @@ export const SETTINGS = [
},
],
},
{
key: "moped_fund_status",
label: "Fund Status",
columns: [
{
key: "funding_status_id",
label: "Status ID",
},
{
key: "funding_status_name",
label: "Name",
},
{
key: "funding_status_description",
label: "Description",
},
],
},
{
key: "moped_milestones",
label: "Milestones",
Expand Down
Loading