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

[Bugfix] Filter by polygon: table could be a query #98

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

rldhont
Copy link
Contributor

@rldhont rldhont commented Nov 19, 2024

The layer filtered by polygon could be a query _features_ids_with_sql_query

The polygon layer could be a query _polygon_for_groups_with_sql_query

@rldhont rldhont requested review from Gustry and mdouchin November 19, 2024 21:21
@Gustry Gustry marked this pull request as draft November 20, 2024 12:12
@Gustry
Copy link
Member

Gustry commented Nov 20, 2024

I was curious how the tests could pass.

If the code is not really tested before the PR, please specify it, otherwise, we were going to make some 500 errors if merged too quickly.

image

isEmpty, startsWith, endsWith does not exist in Python

I want to check how CI could be OK, and also other checks on this PR later

@rldhont
Copy link
Contributor Author

rldhont commented Nov 20, 2024

isEmpty, startsWith, endsWith does not exist in Python

isEmpty, startsWith, endsWith are QString methods not python string ones. I was thinking that is not converted.

I think there is no tests to check build sql.

@rldhont rldhont force-pushed the fix-filter-polygon-table-query branch from 4f54638 to 6509fca Compare November 20, 2024 22:08
@rldhont
Copy link
Contributor Author

rldhont commented Nov 20, 2024

I have updated the code and added a test.

@rldhont rldhont force-pushed the fix-filter-polygon-table-query branch from 6509fca to 99848e2 Compare November 20, 2024 22:11
Copy link
Member

@Gustry Gustry left a comment

Choose a reason for hiding this comment

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

LGTM
Perfect, no code duplication, single static or class method, which is unit-testable ;-)

isEmpty, startsWith, endsWith are QString methods not python string ones

While QString belongs to the QtCore package, it does not exist in Python. It's absolutely not possible to have a QString object in PyQt.

from qgis.PyQt.QtCore import QString
Traceback (most recent call last):
  File "/usr/lib/python3.12/code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
ImportError: cannot import name 'QString' from 'qgis.PyQt.QtCore' (/usr/lib/python3/dist-packages/qgis/PyQt/QtCore.py)

@Gustry Gustry marked this pull request as ready for review November 21, 2024 17:23
@rldhont
Copy link
Contributor Author

rldhont commented Nov 21, 2024

While QString belongs to the QtCore package, it does not exist in Python. It's absolutely not possible to have a QString object in PyQt.

I found the same information after your review. Thanks to point it.

The layer filtered by polygon could be a query `_features_ids_with_sql_query`

The polygon layer  could be a query `_polygon_for_groups_with_sql_query`
@rldhont rldhont force-pushed the fix-filter-polygon-table-query branch from 99848e2 to e5bd3e1 Compare November 22, 2024 07:49
@Gustry Gustry merged commit d2fd68e into 3liz:master Nov 25, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants