Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Address PR comments
  • Loading branch information
elpaso authored and github-actions[bot] committed Dec 9, 2021
1 parent b63395f commit 3058a86
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/server/services/wms/qgswmsrenderer.cpp
Expand Up @@ -362,13 +362,16 @@ namespace QgsWms
else
{
const QgsAttributeList pkIndexes = cLayer->primaryKeyAttributes();
const int pkIndexesSize {std::max( pkIndexes.size(), 1 )};
if ( pkIndexesSize == 0 )
if ( pkIndexes.size() == 0 )
{
QgsDebugMsgLevel( QStringLiteral( "Atlas print: layer %1 has no primary key attributes" ).arg( cLayer->name() ), 2 );
}

// Handles the pk-less case
const int pkIndexesSize {std::max( pkIndexes.size(), 1 )};

QStringList pkAttributeNames;
for ( int pkIndex : pkIndexes )
for ( int pkIndex : std::as_const( pkIndexes ) )
{
pkAttributeNames.append( cLayer->fields().at( pkIndex ).name() );
}
Expand Down Expand Up @@ -414,7 +417,7 @@ namespace QgsWms
{
filterString.append( " AND " );
}
filterString.append( QStringLiteral( "\"%1\" = %2" ).arg( pkAttributeNames.at( j ), atlasPk.at( currentAtlasPk ) ) );
filterString.append( QgsExpression::createFieldEqualityExpression( pkAttributeNames.at( j ), atlasPk.at( currentAtlasPk ) ) );
++currentAtlasPk;
}
}
Expand Down

0 comments on commit 3058a86

Please sign in to comment.