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

Add DEFAULT FALSE on organisation flags #164

Merged
merged 6 commits into from
Mar 5, 2024

Conversation

cymed
Copy link
Contributor

@cymed cymed commented Feb 14, 2024

No description provided.

@sjib sjib requested a review from 3nids February 14, 2024 08:33
@sjib sjib added the fix Fixing something not working label Feb 14, 2024
@@ -72,12 +72,12 @@ COMMENT ON COLUMN tww_od.wastewater_node._status IS 'not part of the VSA-DSS dat
added solely for TEKSI Wastewater & GEP
has to be updated by triggers';

ALTER TABLE tww_od.organisation ADD COLUMN _active bool;
ALTER TABLE tww_od.organisation ADD COLUMN _active bool DEFAULT FALSE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be true, no?
I would expect an organisation added to be active by default. Or am I missing something?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • When we import the VSA organisation dataset with 2100 organisation - do we want all organisations to be active or not? I would say rather not - I just want to set those active that I need afterwards - that was my argument to set the DEFAULT FALSE
  • When I create a new organisation in TEKSI , I can set the _active flag myself to TRUE

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling

UPDATE tww_od.organisation
SET _active=TRUE
WHERE obj_id = ANY(
SELECT UNNEST(ARRAY[fk_provider,fk_dataowner])
FROM tww_od.wastewater_networkelement
UNION
SELECT UNNEST(ARRAY[fk_owner,fk_operator])
FROM tww_od.wastewater_structure
UNION
SELECT fk_operating_company
FROM tww_od.maintenance_event
)

after import would set the active flag correctly 99% of the time after import. @sjib do you see other classes we should check for in such a query?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the logic should be when using the application and not when running import where we can easily play with the data. The defaults should be the ones you need when using QGIS.
That's how I see it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When using QGIS, you need the ones that are present in your data. You get these via the import.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cymed

after import would set the active flag correctly 99% of the time after import. @sjib do you see other classes we should check for in such a query?

We have also
Massnahme.TragerschaftRef
Masnnahme.Verantwortlich_AusloesungRef
Stammkarte.BueroRef
Stammkarte.StandortgemeindeRef
Messstelle.BetreiberRef

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good thoughts from different angles.
I see three use cases with organisations :

  1. Importing organisation datasets ahead of datasets via INTERLIS import
  2. Importing new VSA organisations that we have applied for or additional that we need as for example our TV company partner or summing organisation where we match local organisations to
  3. Creating new (local) organisations during operation in TEKSI (should be avoided if possible, as the goal is to integrate all organisations used to the VSA organisation dataset).

Are there others?

@ponceta
Copy link
Member

ponceta commented Feb 15, 2024

_active should be reserved for calculated field where the value is computed, active or tww_active would be preferable.

It is a core feature of teksi modules, I would be in favor of having it as simple as possible since it will be replicated to all modules.

@cymed cymed closed this Mar 5, 2024
@cymed cymed reopened this Mar 5, 2024
@cymed cymed merged commit 5a133c4 into teksi:main Mar 5, 2024
11 checks passed
@cymed cymed deleted the add_active_flag_for_organisations branch March 5, 2024 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Fixing something not working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants