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

Insert cover only if a cover column is not null #36

Open
wants to merge 95 commits into
base: main
Choose a base branch
from

Conversation

cymed
Copy link
Contributor

@cymed cymed commented Dec 4, 2023

At the moment, a new cover is created whenever a feature is created in vw_tww_wastewater_structure. As some ws have no cover (i.e. most discharge points and infiltration installations), we should only add a cover if any of the cover entries is distinct from NULL.

Edit:
This PR adds a meta function check_all_nulls, which allows to check whether all entries in a jsonb starting with a specific prefix are null. By default, the postfixes obj_id and identifier are ignored.

Example: tww_app.check_all_nulls(to_jsonb(NEW),'co') converts the record NEW to a jsonb. All fields starting with 'co_' are tested whether they are NULL except co_identifier and co_obj_id

The abovementioned meta function is now used to define whether a cover is added or not

@sjib
Copy link
Contributor

sjib commented Dec 4, 2023

Good idea, but I would give some user feedback, if no cover is added.

@urskaufmann
Copy link
Contributor

good point, my solution in the pre-qgep-system was, that I could delete the cover when creating a wastewater_structure.
In qgep/tww we don't want the obj_id to be editable -> if we have a default value for identifier (= obj_id) then we can say, if the user delete the co_identifier, there will be no cover. One problem: I want co_identifier = ws_identifier as default. So the test, if there is a cover has to be before the identifier is set to ws_identifier...

@cymed
Copy link
Contributor Author

cymed commented Dec 4, 2023

I prefer an automated solution so I can use inserts on tww_app.vw_tww_wastewater_structure in gateway exports (i.E. from the Aargau models). Otherwise keeping the gateway up to date is tedious.

@cymed
Copy link
Contributor Author

cymed commented Dec 5, 2023

Good idea, but I would give some user feedback, if no cover is added.

I am now raising a warning.

@ponceta ponceta added enhancement New feature or request datamodel Concerns the datamodel labels Dec 7, 2023
@3nids 3nids closed this Dec 7, 2023
@3nids 3nids reopened this Dec 7, 2023
@cymed

This comment was marked as outdated.

@ponceta
Copy link
Member

ponceta commented Dec 7, 2023

psql:/src/scripts/../changelogs/0001/09_tww_dictionaries.sql:122: NOTICE:  type "tww_od.plantype" does not exist, skipping
psql:/src/scripts/../app/14_geometry_functions.sql:34: NOTICE:  trigger "synchronize_level_with_altitude" for relation "tww_od.wastewater_node" does not exist, skipping
psql:/src/scripts/../app/14_geometry_functions.sql:76: NOTICE:  trigger "synchronize_level_with_altitude" for relation "tww_od.cover" does not exist, skipping
Traceback (most recent call last):
  File "/src/scripts/../app/view/create_views.py", line 273, in <module>
    create_views(
  File "/src/scripts/../app/view/create_views.py", line 193, in create_views
    vw_tww_wastewater_structure(
  File "/src/app/view/vw_tww_wastewater_structure.py", line 392, in vw_tww_wastewater_structure
    columns(
TypeError: columns() got an unexpected keyword argument 'indent'

@ponceta ponceta closed this Sep 20, 2024
@ponceta ponceta reopened this Sep 20, 2024
@cymed cymed closed this Sep 23, 2024
@cymed cymed reopened this Sep 23, 2024
@cymed cymed closed this Oct 3, 2024
@cymed cymed reopened this Oct 3, 2024
cymed added a commit to cymed/TEKSI-wastewater that referenced this pull request Oct 11, 2024
I also altered the cover attributes so they show even if co_obj_id is nul. otherise it is not possible to add a cover via the gui once teksi#36 is ready
@cymed cymed closed this Dec 13, 2024
@cymed cymed reopened this Dec 13, 2024
@cymed cymed closed this Dec 16, 2024
@cymed cymed reopened this Dec 16, 2024
@cymed cymed closed this Dec 16, 2024
@cymed cymed reopened this Dec 16, 2024
@cymed
Copy link
Contributor Author

cymed commented Dec 16, 2024

This PR does not touch the plugin. Did we introduce an error somewhere else?

Edit: it now passes

@cymed cymed requested review from ponceta and removed request for urskaufmann December 16, 2024 13:53
@cymed cymed closed this Dec 17, 2024
@cymed cymed reopened this Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datamodel Concerns the datamodel enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants