-
Notifications
You must be signed in to change notification settings - Fork 5
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
base: main
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
previous syntax interfered with .format
Good idea, but I would give some user feedback, if no cover is added. |
good point, my solution in the pre-qgep-system was, that I could delete the cover when creating a wastewater_structure. |
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. |
I am now raising a warning. |
This comment was marked as outdated.
This comment was marked as outdated.
for more information, see https://pre-commit.ci
…cymed/wastewater into create_covers_when_not_all_null
for more information, see https://pre-commit.ci
|
…cymed/wastewater into create_covers_when_not_all_null
for more information, see https://pre-commit.ci
prefix is a keyword
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
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
This PR does not touch the plugin. Did we introduce an error somewhere else? Edit: it now passes |
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
andidentifier
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 exceptco_identifier
andco_obj_id
The abovementioned meta function is now used to define whether a cover is added or not