diff --git a/moped-database/metadata/tables.yaml b/moped-database/metadata/tables.yaml index 76bd56baf6..e6c33aee4d 100644 --- a/moped-database/metadata/tables.yaml +++ b/moped-database/metadata/tables.yaml @@ -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 diff --git a/moped-database/migrations/1735340549358_add-funding-status-description/down.sql b/moped-database/migrations/1735340549358_add-funding-status-description/down.sql new file mode 100644 index 0000000000..5d16624389 --- /dev/null +++ b/moped-database/migrations/1735340549358_add-funding-status-description/down.sql @@ -0,0 +1,3 @@ +-- Remove the funding_status_description column +ALTER TABLE "public"."moped_fund_status" +DROP COLUMN "funding_status_description"; diff --git a/moped-database/migrations/1735340549358_add-funding-status-description/up.sql b/moped-database/migrations/1735340549358_add-funding-status-description/up.sql new file mode 100644 index 0000000000..19bdbc1c90 --- /dev/null +++ b/moped-database/migrations/1735340549358_add-funding-status-description/up.sql @@ -0,0 +1,14 @@ +ALTER TABLE "public"."moped_fund_status" +ADD COLUMN "funding_status_description" text NULL; + +COMMENT ON COLUMN "public"."moped_fund_status"."funding_status_description" IS 'Description of the funding status'; + +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; \ No newline at end of file diff --git a/moped-database/views/project_list_view.sql b/moped-database/views/project_list_view.sql index 86e3824226..31e4e28466 100644 --- a/moped-database/views/project_list_view.sql +++ b/moped-database/views/project_list_view.sql @@ -15,8 +15,14 @@ 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 @@ -24,7 +30,8 @@ funding_sources_lookup AS ( 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 @@ -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 diff --git a/moped-editor/src/queries/tableLookups.js b/moped-editor/src/queries/tableLookups.js index e2e08b3c68..4e5cb30427 100644 --- a/moped-editor/src/queries/tableLookups.js +++ b/moped-editor/src/queries/tableLookups.js @@ -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 + } } `; diff --git a/moped-editor/src/views/dev/LookupsView/settings.js b/moped-editor/src/views/dev/LookupsView/settings.js index 8af686f76f..8172a919c0 100644 --- a/moped-editor/src/views/dev/LookupsView/settings.js +++ b/moped-editor/src/views/dev/LookupsView/settings.js @@ -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",