Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Nyall Dawson <nyall.dawson@gmail.com>
  • Loading branch information
domi4484 and nyalldawson committed Feb 15, 2021
1 parent 6845431 commit ac18ce9
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/core/expression/qgsexpressionfunction.cpp
Expand Up @@ -5453,22 +5453,22 @@ static QVariant fcnArrayMajority( const QVariantList &values, const QgsExpressio
const int maxValue = *std::max_element( occurrences.constBegin(), occurrences.constEnd() );

const QString option = values.at( 1 ).toString();
if ( option.compare( QStringLiteral( "all" ), Qt::CaseInsensitive ) == 0 )
if ( option.compare( QLatin1String( "all" ), Qt::CaseInsensitive ) == 0 )
{
return convertToSameType( hash.keys( maxValue ), values.at( 0 ).type() );
}
else if ( option.compare( QStringLiteral( "first" ), Qt::CaseInsensitive ) == 0 )
else if ( option.compare( QLatin1String( "first" ), Qt::CaseInsensitive ) == 0 )
{
if ( hash.keys().isEmpty() )
if ( hash.isEmpty() )
return QVariant();

return QVariant( hash.keys( maxValue ).first() );
}
else if ( option.compare( QStringLiteral( "median" ), Qt::CaseInsensitive ) == 0 )
else if ( option.compare( QLatin1String( "median" ), Qt::CaseInsensitive ) == 0 )
{
return fcnArrayMedian( QVariantList() << convertToSameType( hash.keys( maxValue ), values.at( 0 ).type() ), context, parent, node );
}
else if ( option.compare( QStringLiteral( "real_majority" ), Qt::CaseInsensitive ) == 0 )
else if ( option.compare( QLatin1String( "real_majority" ), Qt::CaseInsensitive ) == 0 )
{
if ( maxValue * 2 <= list.size() )
return QVariant();
Expand All @@ -5494,22 +5494,22 @@ static QVariant fcnArrayMinority( const QVariantList &values, const QgsExpressio
const int minValue = *std::min_element( occurrences.constBegin(), occurrences.constEnd() );

const QString option = values.at( 1 ).toString();
if ( option.compare( QStringLiteral( "all" ), Qt::CaseInsensitive ) == 0 )
if ( option.compare( QLatin1String( "all" ), Qt::CaseInsensitive ) == 0 )
{
return convertToSameType( hash.keys( minValue ), values.at( 0 ).type() );
}
else if ( option.compare( QStringLiteral( "first" ), Qt::CaseInsensitive ) == 0 )
else if ( option.compare( QLatin1String( "first" ), Qt::CaseInsensitive ) == 0 )
{
if ( hash.keys().isEmpty() )
if ( hash.isEmpty() )
return QVariant();

return QVariant( hash.keys( minValue ).first() );
}
else if ( option.compare( QStringLiteral( "median" ), Qt::CaseInsensitive ) == 0 )
else if ( option.compare( QLatin1String( "median" ), Qt::CaseInsensitive ) == 0 )
{
return fcnArrayMedian( QVariantList() << convertToSameType( hash.keys( minValue ), values.at( 0 ).type() ), context, parent, node );
}
else if ( option.compare( QStringLiteral( "real_minority" ), Qt::CaseInsensitive ) == 0 )
else if ( option.compare( QLatin1String( "real_minority" ), Qt::CaseInsensitive ) == 0 )
{
if ( hash.keys().isEmpty() )
return QVariant();
Expand Down

0 comments on commit ac18ce9

Please sign in to comment.