Skip to content

Commit

Permalink
Merge pull request #538 from cymed/fix-tww_symbology_inflow_prio-
Browse files Browse the repository at this point in the history
fix tww_symbology_inflow_prio
  • Loading branch information
cymed authored Feb 4, 2025
2 parents c96d180 + 8d2efe0 commit 9cc24a7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
4 changes: 2 additions & 2 deletions datamodel/app/functions/symbology_functions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ FROM(

WHERE _all OR wn.obj_id = _obj_id
WINDOW w AS ( PARTITION BY wn.obj_id
ORDER BY coalesce(vl_fct_hier_to.tww_symbology_inflow_prio,false) DESC
ORDER BY coalesce(vl_usg_curr_from.tww_symbology_inflow_prio,false) DESC
, vl_fct_hier_from.tww_symbology_order ASC NULLS LAST
, vl_fct_hier_to.tww_symbology_order ASC NULLS LAST

Expand Down Expand Up @@ -178,7 +178,7 @@ FROM(
LEFT JOIN tww_vl.channel_usage_current vl_usg_curr_from ON wn_from._usage_current = vl_usg_curr_from.code
WHERE (_all OR wn.obj_id = _obj_id)
WINDOW w AS ( PARTITION BY wn.obj_id
ORDER BY coalesce(vl_fct_hier.tww_symbology_inflow_prio,false) DESC
ORDER BY coalesce(vl_usg_curr_from.tww_symbology_inflow_prio,false) DESC
, vl_fct_hier.tww_symbology_order ASC NULLS LAST
, vl_fct_hier_from.tww_symbology_order ASC NULLS LAST

Expand Down
28 changes: 15 additions & 13 deletions datamodel/changelogs/0001/05_data_model_extensions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,25 @@ SET tww_symbology_order=
]
,code);

-- this column is an extension to the VSA data model and facilitates filtering out primary features
ALTER TABLE tww_vl.channel_function_hierarchic ADD COLUMN tww_is_primary bool DEFAULT FALSE;
UPDATE tww_vl.channel_function_hierarchic
SET tww_is_primary=true
WHERE left(value_en, 4)='pwwf';
UPDATE tww_vl.channel_function_hierarchic
SET tww_is_primary=false
WHERE left(value_en, 4)<>'pwwf';
COMMENT ON COLUMN tww_vl.channel_function_hierarchic.tww_is_primary IS 'True when part of the primary network. Facilitates exporting primary elements only.
Not part of the VSA-DSS data model, added solely for TEKSI Wastewater & GEP';

-- this column is an extension to the VSA data model defines which function_hierarchic to use in labels
ALTER TABLE tww_vl.channel_function_hierarchic ADD COLUMN tww_use_in_labels bool DEFAULT false;
UPDATE tww_vl.channel_function_hierarchic
SET tww_use_in_labels= true WHERE value_en like 'pwwf%';

-- this column is an extension to the VSA data model defines which function_hierarchic to use in labels
ALTER TABLE tww_vl.channel_function_hierarchic ADD COLUMN tww_symbology_inflow_prio bool DEFAULT false;
UPDATE tww_vl.channel_function_hierarchic
-- this column is an extension to the VSA data model defines which inflow usage_current is prioritised over the outflow
ALTER TABLE tww_vl.channel_usage_current ADD COLUMN tww_symbology_inflow_prio bool DEFAULT false;
UPDATE tww_vl.channel_usage_current
SET tww_symbology_inflow_prio= true WHERE code =4516;


Expand All @@ -81,16 +92,7 @@ SET tww_symbology_order=
]
,code);

-- this column is an extension to the VSA data model and facilitates filtering out primary features
ALTER TABLE tww_vl.channel_function_hierarchic ADD COLUMN tww_is_primary bool DEFAULT FALSE;
UPDATE tww_vl.channel_function_hierarchic
SET tww_is_primary=true
WHERE left(value_en, 4)='pwwf';
UPDATE tww_vl.channel_function_hierarchic
SET tww_is_primary=false
WHERE left(value_en, 4)<>'pwwf';
COMMENT ON COLUMN tww_vl.channel_function_hierarchic.tww_is_primary IS 'True when part of the primary network. Facilitates exporting primary elements only.
Not part of the VSA-DSS data model, added solely for TEKSI Wastewater & GEP';


-- table wastewater_node is extended to hold additional attributes necessary for symbology reasons
-- extended attributes are started with an underscore
Expand Down

0 comments on commit 9cc24a7

Please sign in to comment.