Skip to content

Commit

Permalink
Merge pull request #388 from cymed/fix-secondary-node-and-cover
Browse files Browse the repository at this point in the history
Fix updating of fk_main_wastewater_node/fk_main_cover
  • Loading branch information
ponceta authored Aug 27, 2024
2 parents a1c7f46 + 478a26f commit 8e662e6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions datamodel/app/symbology_functions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ LANGUAGE plpgsql VOLATILE;
--------------------------------------------------------
-- UPDATE wastewater structure fk_main_cover
-- Argument:
-- * obj_id of wastewater structure
-- * obj_id of wastewater structure. No change if fk_main_cover is not null
-- * all True to update all
-- * omit both arguments to update all where fk_main_cover is null
--------------------------------------------------------
Expand All @@ -308,7 +308,7 @@ BEGIN
LEFT JOIN tww_od.structure_part sp ON sp.fk_wastewater_structure = ws.obj_id
LEFT JOIN tww_od.cover co ON sp.obj_id = co.obj_id
LEFT JOIN tww_od.channel ch ON ch.obj_id = ws.obj_id
WHERE ch.obj_id IS NULL AND (_all OR ws.obj_id = _obj_id OR ( NOT _all AND _obj_id is NULL AND ws.fk_main_cover IS NULL))
WHERE ch.obj_id IS NULL AND (_all OR ((ws.obj_id = _obj_id OR (NOT _all AND _obj_id is NULL)) AND ws.fk_main_cover IS NULL))
) ws_covers
WHERE ws.obj_id = ws_covers.obj_id;
END
Expand All @@ -320,7 +320,7 @@ VOLATILE;
--------------------------------------------------------
-- UPDATE wastewater structure fk_main_wastewater_node
-- Argument:
-- * obj_id of wastewater structure
-- * obj_id of wastewater structure. No change if fk_main_wastewater_node is not null
-- * all True to update all
-- * omit both arguments to update all where fk_main_wastewater_node is null
--------------------------------------------------------
Expand All @@ -340,7 +340,7 @@ BEGIN
LEFT JOIN tww_od.wastewater_networkelement ne ON ne.fk_wastewater_structure = ws.obj_id
LEFT JOIN tww_od.wastewater_node wn ON ne.obj_id = wn.obj_id
LEFT JOIN tww_od.channel ch ON ch.obj_id = ws.obj_id
WHERE ch.obj_id IS NULL AND (_all OR ws.obj_id = _obj_id OR ( NOT _all AND _obj_id is NULL AND ws.fk_main_wastewater_node IS NULL))
WHERE ch.obj_id IS NULL AND (_all OR ((ws.obj_id = _obj_id OR (NOT _all AND _obj_id is NULL)) AND ws.fk_main_wastewater_node IS NULL))
) ws_nodes
WHERE ws.obj_id = ws_nodes.obj_id;
END
Expand Down

0 comments on commit 8e662e6

Please sign in to comment.