From 9d068d4f8ffbb828cf0da7c63d1aabd090243510 Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Wed, 22 Jan 2025 12:47:44 +0100 Subject: [PATCH 1/2] fix tww_symbology_inflow_prio the additional field tww_symbology_inflow_prio should be on usage_current instead of function_hierarchic --- .../0001/05_data_model_extensions.sql | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/datamodel/changelogs/0001/05_data_model_extensions.sql b/datamodel/changelogs/0001/05_data_model_extensions.sql index 203916ea3..481aed2e5 100644 --- a/datamodel/changelogs/0001/05_data_model_extensions.sql +++ b/datamodel/changelogs/0001/05_data_model_extensions.sql @@ -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; @@ -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 From 8d2efe04cf85d8236a35565d7da5e7a6105524ac Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Wed, 22 Jan 2025 13:09:38 +0100 Subject: [PATCH 2/2] fix in symbology functions --- datamodel/app/functions/symbology_functions.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/datamodel/app/functions/symbology_functions.sql b/datamodel/app/functions/symbology_functions.sql index c3adc4d05..3287bb3d7 100644 --- a/datamodel/app/functions/symbology_functions.sql +++ b/datamodel/app/functions/symbology_functions.sql @@ -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 @@ -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