Skip to content

Commit

Permalink
Fix logic
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jul 12, 2021
1 parent 98178e1 commit 0a74c97
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core/providers/qgsproviderutils.cpp
Expand Up @@ -25,7 +25,7 @@ bool QgsProviderUtils::sublayerDetailsAreIncomplete( const QList<QgsProviderSubl
{
case QgsMapLayerType::VectorLayer:
if ( sublayer.wkbType() == QgsWkbTypes::Unknown
|| ( ignoreUnknownFeatureCount &&
|| ( !ignoreUnknownFeatureCount &&
( sublayer.featureCount() == static_cast< long long >( Qgis::FeatureCountState::Uncounted )
|| sublayer.featureCount() == static_cast< long long >( Qgis::FeatureCountState::UnknownCount ) ) ) )
return true;
Expand Down
4 changes: 2 additions & 2 deletions tests/src/python/test_qgsproviderutils.py
Expand Up @@ -64,9 +64,9 @@ def test_sublayerDetailsAreIncomplete(self):
self.assertEqual(sublayers[3].featureCount(), Qgis.FeatureCountState.Uncounted)

# need to count features for complete details about this uri!
self.assertTrue(QgsProviderUtils.sublayerDetailsAreIncomplete(sublayers, True))
self.assertTrue(QgsProviderUtils.sublayerDetailsAreIncomplete(sublayers, False))
# ...unless we are ignoring unknown feature counts, that is...
self.assertFalse(QgsProviderUtils.sublayerDetailsAreIncomplete(sublayers, False))
self.assertFalse(QgsProviderUtils.sublayerDetailsAreIncomplete(sublayers, True))

# retry with retrieving feature count
sublayers = QgsProviderRegistry.instance().querySublayers(uri, Qgis.SublayerQueryFlag.CountFeatures)
Expand Down

0 comments on commit 0a74c97

Please sign in to comment.