Skip to content

False warning for relations #860

@harminius

Description

@harminius

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.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions