MerginMaps / MerginMaps/qgis-plugin
False warning for relations
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 44
- Forks
- 20
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 5
Description
When the project is synced, the feature count is not updated. This can be misleading for users who display the feature count next to the layers in the Layers panel. Moreover, we use this feature count in a validation when there is a relation. Users are warned about bad relation setup, which is really confusing.
Reloading the project after sync might solve all these issues. 🤞
From the discussion:
The key line in plugin is this:
feature_count = layer.dataProvider().featureCount()
for f in fields:
if len(layer.uniqueValues(f)) != feature_count
And the issue is that when you sync changes from the mobile app in QGIS, the feature count from the provider (gpkg) is not updated. It causes a mismatch, resulting in the misleading warning. When you restart QGIS, the feature count is correctly updated, and the warning is gone. This validation is run only when relations are set up in the project.
If you change the number of features in QGIS the feature count is recalculated immediately.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the relation validation containing layer.dataProvider().featureCount() and layer.uniqueValues(f), then trace how project sync completes in the QGIS plugin. Reproduce by syncing mobile changes to a project with relations; done means the feature count is refreshed and the misleading bad-relation warning no longer appears.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- databases, desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100