From 92698e75e6a36b95fbd860dce7f808b4ad635d40 Mon Sep 17 00:00:00 2001 From: mateoclarke Date: Thu, 12 Dec 2024 13:17:18 -0700 Subject: [PATCH 1/7] add fund status to settings --- .../src/views/dev/LookupsView/settings.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/moped-editor/src/views/dev/LookupsView/settings.js b/moped-editor/src/views/dev/LookupsView/settings.js index 8af686f76f..41080fd545 100644 --- a/moped-editor/src/views/dev/LookupsView/settings.js +++ b/moped-editor/src/views/dev/LookupsView/settings.js @@ -223,4 +223,22 @@ 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", + }, + ], + }, ]; From 76ee8be1299f1201ef8bfe6868434e0d9869c6e4 Mon Sep 17 00:00:00 2001 From: mateoclarke Date: Fri, 27 Dec 2024 15:49:22 -0700 Subject: [PATCH 2/7] add fund status to table query --- moped-editor/src/queries/tableLookups.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/moped-editor/src/queries/tableLookups.js b/moped-editor/src/queries/tableLookups.js index e2e08b3c68..9e7c9aa583 100644 --- a/moped-editor/src/queries/tableLookups.js +++ b/moped-editor/src/queries/tableLookups.js @@ -75,5 +75,9 @@ export const TABLE_LOOKUPS_QUERY = gql` project_role_name project_role_description } + moped_fund_status(where: { funding_status_id: { _neq: 0 } }) { + funding_status_name + funding_status_id + } } `; From 51afa71d22281f891eb0711ed2ed30b1a5decf46 Mon Sep 17 00:00:00 2001 From: mateoclarke Date: Fri, 27 Dec 2024 16:09:24 -0700 Subject: [PATCH 3/7] Add funding_status_description via migration with metadata permission update --- moped-database/metadata/tables.yaml | 3 +++ .../down.sql | 3 +++ .../up.sql | 14 ++++++++++++++ moped-editor/src/queries/tableLookups.js | 1 + 4 files changed, 21 insertions(+) create mode 100644 moped-database/migrations/1735340549358_add-funding-status-description/down.sql create mode 100644 moped-database/migrations/1735340549358_add-funding-status-description/up.sql 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..aa30891c08 --- /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 NULL + 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-editor/src/queries/tableLookups.js b/moped-editor/src/queries/tableLookups.js index 9e7c9aa583..445b285d0d 100644 --- a/moped-editor/src/queries/tableLookups.js +++ b/moped-editor/src/queries/tableLookups.js @@ -78,6 +78,7 @@ export const TABLE_LOOKUPS_QUERY = gql` moped_fund_status(where: { funding_status_id: { _neq: 0 } }) { funding_status_name funding_status_id + funding_status_description } } `; From bd5df2263fadf432bebf1fc18dedb451adf7cb51 Mon Sep 17 00:00:00 2001 From: Moped View Bot Date: Fri, 27 Dec 2024 23:10:36 +0000 Subject: [PATCH 4/7] =?UTF-8?q?=F0=9F=A4=96=20Export=20view=20for=2019665?= =?UTF-8?q?=5Ffund=5Fstatus=5Fdata=5Fdictionary?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- moped-database/views/project_list_view.sql | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) 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 From ab9bcfc55854ebcb77b9f95c278fbd6c6f502fc7 Mon Sep 17 00:00:00 2001 From: mateoclarke Date: Fri, 27 Dec 2024 16:19:57 -0700 Subject: [PATCH 5/7] fix indentation --- .../up.sql | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/moped-database/migrations/1735340549358_add-funding-status-description/up.sql b/moped-database/migrations/1735340549358_add-funding-status-description/up.sql index aa30891c08..2b39d26c50 100644 --- a/moped-database/migrations/1735340549358_add-funding-status-description/up.sql +++ b/moped-database/migrations/1735340549358_add-funding-status-description/up.sql @@ -1,14 +1,14 @@ - ALTER TABLE "public"."moped_fund_status" - ADD COLUMN "funding_status_description" text NULL; +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'; +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 NULL - WHEN 'Set up' THEN 'Funding has been set up in eCAPRIS; has FDU' - ELSE "funding_status_description" - END; \ No newline at end of file +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 NULL + WHEN 'Set up' THEN 'Funding has been set up in eCAPRIS; has FDU' + ELSE "funding_status_description" +END; \ No newline at end of file From ea5ed9e8683f3f62c437fadab4476072d50fb2d6 Mon Sep 17 00:00:00 2001 From: mateoclarke Date: Fri, 27 Dec 2024 16:30:43 -0700 Subject: [PATCH 6/7] add comment to query --- moped-editor/src/queries/tableLookups.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/moped-editor/src/queries/tableLookups.js b/moped-editor/src/queries/tableLookups.js index 445b285d0d..4e5cb30427 100644 --- a/moped-editor/src/queries/tableLookups.js +++ b/moped-editor/src/queries/tableLookups.js @@ -75,7 +75,10 @@ export const TABLE_LOOKUPS_QUERY = gql` project_role_name project_role_description } - moped_fund_status(where: { funding_status_id: { _neq: 0 } }) { + moped_fund_status( + # Filter out the "Archived" status + where: { funding_status_id: { _neq: 0 } } + ) { funding_status_name funding_status_id funding_status_description From faa2ac539190ca8ed732f4c7329cb3c610b6d6c9 Mon Sep 17 00:00:00 2001 From: mateoclarke Date: Mon, 30 Dec 2024 12:03:17 -0700 Subject: [PATCH 7/7] PR feedback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - description for “Funding setup requested” - alphabetize data dictionary --- .../up.sql | 2 +- .../src/views/dev/LookupsView/settings.js | 36 +++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/moped-database/migrations/1735340549358_add-funding-status-description/up.sql b/moped-database/migrations/1735340549358_add-funding-status-description/up.sql index 2b39d26c50..19bdbc1c90 100644 --- a/moped-database/migrations/1735340549358_add-funding-status-description/up.sql +++ b/moped-database/migrations/1735340549358_add-funding-status-description/up.sql @@ -8,7 +8,7 @@ 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 NULL + 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-editor/src/views/dev/LookupsView/settings.js b/moped-editor/src/views/dev/LookupsView/settings.js index 41080fd545..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", @@ -223,22 +241,4 @@ 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", - }, - ], - }, ];