Skip to content

Commit 106f689

Browse files
authored
Merge pull request #1619 from cityofaustin/23235_add_lane_conversion_work_type_to_various_components
23235 add lane conversion work type to various components
2 parents dd7fb79 + 9364557 commit 106f689

3 files changed

Lines changed: 20 additions & 14 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
DELETE FROM public.moped_component_work_types
2+
WHERE work_type_id = (
3+
SELECT id FROM moped_work_types WHERE key = 'lane_conversion'
4+
)
5+
AND component_id IN (
6+
SELECT component_id
7+
FROM moped_components
8+
WHERE component_name_full IN ('Project Extent - Generic (linear)', 'Transit - Lane', 'Transit - Managed Lane Access Point', 'Transit - Transit/Bike Lane', 'Transit - Transit Queue Jump')
9+
);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
INSERT INTO public.moped_component_work_types (component_id, work_type_id)
2+
SELECT
3+
moped_components.component_id,
4+
moped_work_types.id
5+
FROM moped_components, moped_work_types
6+
WHERE moped_components.component_name_full IN ('Project Extent - Generic (linear)', 'Transit - Lane', 'Transit - Managed Lane Access Point', 'Transit - Transit/Bike Lane', 'Transit - Transit Queue Jump')
7+
AND moped_work_types.key = 'lane_conversion';

moped-database/views/project_list_view.sql

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,16 @@ CREATE OR REPLACE VIEW project_list_view AS WITH project_person_list_lookup AS (
1515
funding_sources_lookup AS (
1616
SELECT
1717
mpf.project_id,
18-
string_agg(
19-
DISTINCT mfs.funding_source_name, ', '::text
20-
ORDER BY mfs.funding_source_name
21-
) AS funding_source_name,
22-
string_agg(
23-
DISTINCT mfp.funding_program_name, ', '::text
24-
ORDER BY mfp.funding_program_name
25-
) AS funding_program_names,
18+
string_agg(DISTINCT mfs.funding_source_name, ', '::text ORDER BY mfs.funding_source_name) AS funding_source_name,
19+
string_agg(DISTINCT mfp.funding_program_name, ', '::text ORDER BY mfp.funding_program_name) AS funding_program_names,
2620
string_agg(
2721
DISTINCT
2822
CASE
2923
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)
3024
WHEN mfs.funding_source_name IS NOT null THEN mfs.funding_source_name
3125
WHEN mfp.funding_program_name IS NOT null THEN mfp.funding_program_name
3226
ELSE null::text
33-
END, ', '::text
34-
ORDER BY (
27+
END, ', '::text ORDER BY (
3528
CASE
3629
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)
3730
WHEN mfs.funding_source_name IS NOT null THEN mfs.funding_source_name
@@ -168,10 +161,7 @@ min_estimated_phase_dates AS (
168161
project_component_work_types AS (
169162
SELECT
170163
mpc.project_id,
171-
string_agg(
172-
DISTINCT mwt.name, ', '::text
173-
ORDER BY mwt.name
174-
) AS component_work_type_names
164+
string_agg(DISTINCT mwt.name, ', '::text ORDER BY mwt.name) AS component_work_type_names
175165
FROM moped_proj_components mpc
176166
LEFT JOIN moped_proj_component_work_types mpcwt ON mpc.project_component_id = mpcwt.project_component_id
177167
LEFT JOIN moped_work_types mwt ON mpcwt.work_type_id = mwt.id

0 commit comments

Comments
 (0)