Skip to content

Commit

Permalink
feat(v_views): replace references to v_arc/node with v_edit_arc/node
Browse files Browse the repository at this point in the history
  • Loading branch information
mguzman14 committed Aug 5, 2024
1 parent abb9f4e commit 3061930
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions ud/fct/ud_gw_fct_pg2epa_export_inp.sql
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ BEGIN
FROM inp_coverage
JOIN v_edit_inp_subcatchment ON inp_coverage.subc_id::text = v_edit_inp_subcatchment.subc_id::text
LEFT JOIN ( SELECT DISTINCT ON (a.subc_id) a.subc_id,
v_node.node_id
v_edit_node.node_id
FROM ( SELECT unnest(inp_subcatchment.outlet_id::text[]) AS node_array,
inp_subcatchment.subc_id,
inp_subcatchment.outlet_id,
Expand Down Expand Up @@ -233,7 +233,7 @@ BEGIN
inp_subcatchment.descript
FROM inp_subcatchment
WHERE "left"(inp_subcatchment.outlet_id::text, 1) = '{'::text) a
JOIN v_node ON v_node.node_id::text = a.node_array) b ON v_edit_inp_subcatchment.subc_id::text = b.subc_id::text;
JOIN v_edit_node ON v_edit_node.node_id::text = a.node_array) b ON v_edit_inp_subcatchment.subc_id::text = b.subc_id::text;


CREATE OR REPLACE TEMP VIEW vi_t_dividers AS
Expand Down Expand Up @@ -351,7 +351,7 @@ BEGIN
FROM v_edit_inp_subcatchment
JOIN inp_groundwater ON inp_groundwater.subc_id::text = v_edit_inp_subcatchment.subc_id::text
LEFT JOIN ( SELECT DISTINCT ON (a.subc_id) a.subc_id,
v_node.node_id
v_edit_node.node_id
FROM ( SELECT unnest(inp_subcatchment.outlet_id::text[]) AS node_array,
inp_subcatchment.subc_id,
inp_subcatchment.outlet_id,
Expand Down Expand Up @@ -386,7 +386,7 @@ BEGIN
inp_subcatchment.descript
FROM inp_subcatchment
WHERE "left"(inp_subcatchment.outlet_id::text, 1) = '{'::text) a
JOIN v_node ON v_node.node_id::text = a.node_array) b ON v_edit_inp_subcatchment.subc_id::text = b.subc_id::text;
JOIN v_edit_node ON v_edit_node.node_id::text = a.node_array) b ON v_edit_inp_subcatchment.subc_id::text = b.subc_id::text;


CREATE OR REPLACE TEMP VIEW vi_t_gully AS
Expand Down
22 changes: 11 additions & 11 deletions ud/fct/ud_gw_fct_pg2epa_fill_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ BEGIN
LEFT JOIN v_edit_node USING (node_id) -- we need to use v_edit_node to work with sys_* fields
JOIN inp_junction ON node.node_id=inp_junction.node_id
JOIN (
SELECT node_1 AS node_id FROM selector_sector s, v_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '||
SELECT node_1 AS node_id FROM selector_sector s, v_edit_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '||
v_statetype ||' UNION
SELECT node_2 FROM selector_sector s, v_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '||
SELECT node_2 FROM selector_sector s, v_edit_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '||
v_statetype ||')a ON node.node_id=a.node_id
UNION
SELECT '||quote_literal(result_id_var)||',
Expand All @@ -88,9 +88,9 @@ BEGIN
LEFT JOIN v_edit_node USING (node_id)
JOIN inp_divider ON node.node_id=inp_divider.node_id
JOIN (
SELECT node_1 AS node_id FROM selector_sector s, v_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '||
SELECT node_1 AS node_id FROM selector_sector s, v_edit_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '||
v_statetype ||' UNION
SELECT node_2 FROM selector_sector s, v_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '||
SELECT node_2 FROM selector_sector s, v_edit_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '||
v_statetype ||')a ON node.node_id=a.node_id
UNION
SELECT '||quote_literal(result_id_var)||',
Expand All @@ -100,9 +100,9 @@ BEGIN
LEFT JOIN v_edit_node USING (node_id)
JOIN inp_storage ON node.node_id=inp_storage.node_id
JOIN (
SELECT node_1 AS node_id FROM selector_sector s, v_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '||
SELECT node_1 AS node_id FROM selector_sector s, v_edit_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '||
v_statetype ||' UNION
SELECT node_2 FROM selector_sector s, v_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '||
SELECT node_2 FROM selector_sector s, v_edit_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '||
v_statetype ||')a ON node.node_id=a.node_id
UNION
SELECT '||quote_literal(result_id_var)||',
Expand All @@ -112,9 +112,9 @@ BEGIN
LEFT JOIN v_edit_node USING (node_id)
JOIN inp_outfall ON node.node_id=inp_outfall.node_id
JOIN (
SELECT node_1 AS node_id FROM selector_sector s, v_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '||
SELECT node_1 AS node_id FROM selector_sector s, v_edit_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '||
v_statetype ||' UNION
SELECT node_2 FROM selector_sector s, v_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '||
SELECT node_2 FROM selector_sector s, v_edit_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '||
v_statetype ||')a ON node.node_id=a.node_id
UNION
SELECT '||quote_literal(result_id_var)||',
Expand All @@ -124,9 +124,9 @@ BEGIN
LEFT JOIN v_edit_node USING (node_id)
JOIN inp_netgully ON node.node_id=inp_netgully.node_id
JOIN (
SELECT node_1 AS node_id FROM selector_sector s, v_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '||
SELECT node_1 AS node_id FROM selector_sector s, v_edit_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '||
v_statetype ||' UNION
SELECT node_2 FROM selector_sector s, v_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '||
SELECT node_2 FROM selector_sector s, v_edit_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '||
v_statetype ||')a ON node.node_id=a.node_id';


Expand Down Expand Up @@ -182,7 +182,7 @@ BEGIN
barrels,
slope,
culvert, kentry, kexit, kavg, flap, seepage, (now()::date-a.builtdate)/30
FROM selector_sector, v_arc a
FROM selector_sector, v_edit_arc a
LEFT JOIN value_state_type ON id=state_type
LEFT JOIN cat_mat_arc ON matcat_id = cat_mat_arc.id
LEFT JOIN inp_conduit ON a.arc_id = inp_conduit.arc_id
Expand Down

0 comments on commit 3061930

Please sign in to comment.