Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix tww_symbology_inflow_prio #538

Merged
merged 2 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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