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 updating of fk_main_wastewater_node/fk_main_cover #388

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

cymed
Copy link
Contributor

@cymed cymed commented Aug 23, 2024

When creating the functions tww_app.wastewater_structure_update_fk_main_wastewater_node / tww_app.wastewater_structure_update_fk_main_cover, the idea was to call them only in obj_id mode if a structure has no fk_main_wastewater_node/fk_main_cover.

Now, we intend to use them in trigger functions regardless whether the fk_main_wastewater_node/fk_main_cover is NULL or not. This poses a problem as the function sets the fk_main_xxx to the min value of all cover/node oids linked to the wastewater structure. If I have a main cover that has a higher OID than a secondary one, the triggers will overwrite that setting on wastewater structure when altering any cover attribute.

To mitigate that problem,when calling tww_app.wastewater_structure_update_fk_main_xxx(obj_id) we now only update the main cover/wastewater_node if the value is NULL. Calling tww_app.wastewater_structure_update_fk_main_xxx(NULL) continues to set it for all where fk_main_xxx is NULL, calling tww_app.wastewater_structure_update_fk_main_xxx(NULL,true) overwrites the fk_main_xx for all entries

@cymed cymed self-assigned this Aug 23, 2024
@ponceta ponceta added datamodel Concerns the datamodel fix Fixing something not working labels Aug 27, 2024
@ponceta ponceta self-requested a review August 27, 2024 12:52
@ponceta ponceta merged commit 8e662e6 into teksi:main Aug 27, 2024
7 checks passed
@cymed cymed deleted the fix-secondary-node-and-cover branch August 27, 2024 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datamodel Concerns the datamodel fix Fixing something not working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants