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

2022-12 Change filter wastewater structures #94

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

sjib
Copy link
Contributor

@sjib sjib commented Dec 12, 2022

  • filtering on fk_wastewater_structures instead of selected wastewater_nodes:
    • replaced query = query.filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) with
      query = query.filter(QGEP.wastewater_networkelement.fk_wastewater_structure.in_(wws_ids))
  • to be able to do that qgep_export needs new argument selection2 with the obj_id's of the selected elements from vw_gep_wastewater_structure
  • this needs a new function def selected_wws(self) in gui_export.py
  • adapting the qgep_export call in init.py: qgep_export(selection=export_dialog.selected_ids, selection2=export_dialog.selected_wws, labels_file=labels_file_path)

- filtering on fk_wastewater_structures instead of selected wastewater_nodes:
  - replaced query = query.filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids))
with
        query = query.filter(QGEP.wastewater_networkelement.fk_wastewater_structure.in_(wws_ids))
- to be able to do that qgep_export needs new argument selection2 with the obj_id's of the selected elements from vw_gep_wastewater_structure
- this needs a new function def selected_wws(self) in gui_export.py
- adapting the qgep_export call in _init_.py: qgep_export(selection=export_dialog.selected_ids, selection2=export_dialog.selected_wws, labels_file=labels_file_path)
@sjib sjib changed the title 2022-12 Change filter wastewater structures [WIP] 2022-12 Change filter wastewater structures Dec 13, 2022
@sjib sjib marked this pull request as draft December 13, 2022 11:09
 if only changed to wws_ids then we get the aditional wastewater_nodes in a structure but we miss wastewater_nodes of nodes without a structure (this can happen in Secondary network, should not be in the primary network except if we have two reaches in a channel):
query = query.filter(QGEP.wastewater_networkelement.fk_wastewater_structure.in_(wws_ids) or QGEP.wastewater_networkelement.obj_id.in_(subset_ids))
@sjib
Copy link
Contributor Author

sjib commented Dec 15, 2022

Should fix #93

@sjib
Copy link
Contributor Author

sjib commented Dec 15, 2022

Second wastewater_node now ok, but reach point of overflow pipe at wrong place:
20221215_haltung_ueberlauf_von_hp_falscher_ort

20221215_haltung_ueberlauf_von_hp_falsche_ak_ref
and wrong relation to ak instead of overflow ak

@sjib sjib marked this pull request as ready for review January 7, 2023 17:16
@sjib sjib changed the title [WIP] 2022-12 Change filter wastewater structures 2022-12 Change filter wastewater structures Jan 7, 2023
@ponceta ponceta added the enhancement New feature or request label Jan 10, 2023
@ponceta
Copy link
Member

ponceta commented Jan 10, 2023

@olivierdalang will review this.

@olivierdalang
Copy link
Collaborator

@sjib Could you add a regression test (a test that would fail without your fix, and that works with your fix) ? You can copy test_case_e_export_selection in test_qgep.py to TestRegressions, adapt the selected ids as well as the assertions in the output (the tests use the demo data, so you can just use whatever you used when you manually reproduced the issue).

If you're not sure how this can be done, can you give me an example of an object id to select that creates an export with missing objects, also stating the ids of the missing objects in the export ?

Once that's in place, I will suggest some refactoring directly in the code:

  • mainly reuse the same selection argument, as I think it's easier to just keep one list of selection ids, the fact that they are of different type of objects shouldn't matter
  • remove comments from the code (since we're using git, comments with the date at which one line was added are better left out, this information is already present in the git history)

(it's better to do the regression test first, so we can ensure your fix will still work after refactoring)

@sjib
Copy link
Contributor Author

sjib commented Feb 22, 2023

I cannot find an example in the testdataset Arbon at the moment. I have to check back on the data with the issue.
The integration of additional datamodels in Export / Import has higher priority.

@olivierdalang olivierdalang removed their request for review March 1, 2023 15:01
@olivierdalang
Copy link
Collaborator

(converting this to draft so we don't merge by accident until comment are sorted)

@olivierdalang olivierdalang marked this pull request as draft March 9, 2023 08:01
@sjib
Copy link
Contributor Author

sjib commented Mar 31, 2023

@ponceta
Copy link
Member

ponceta commented Oct 23, 2023

@sjib do we want this for 1.6.1 or do we save it for later?

What has to be achieved to finish this work?

@sjib
Copy link
Contributor Author

sjib commented Oct 23, 2023

@sjib do we want this for 1.6.1 or do we save it for later?

What has to be achieved to finish this work?

The main point that Olivier suggested was to write a regression test. I tried, but I was not sucessful to find a suitable example in our demodata.
So if this is the only missing part for 1.6.1 I suggest not to merge it for now, but still include this point in testing, if all wastewater_nodes will get exported (see original issue: "Additional wastwater_nodes not exported with Limit to selection"
#93).
We then would have a reconfirmation of the need during testing (here especially include @DflGruBoe ) and could still integrate it in the final version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants