Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix regression in Dynamic Temporal Controller, "Include Start, Includ…
…e End" no longer works

Fixes #348946 by also casting the end expression

I think this is just forgotten in an earlier commit.
When the start is 'cast' but the end is not, there are issues when
for example the actual values are Date's (instead of DateTime's).
  • Loading branch information
rduivenvoorde committed Sep 4, 2022
1 parent 84cffda commit 8706c7e
Show file tree
Hide file tree
Showing 2 changed files with 199 additions and 111 deletions.
4 changes: 2 additions & 2 deletions src/core/vector/qgsvectorlayertemporalproperties.cpp
Expand Up @@ -540,7 +540,7 @@ QString QgsVectorLayerTemporalProperties::createFilterString( const QgsVectorLay
case QgsUnitTypes::TemporalIrregularStep:
return QString();
}
return QStringLiteral( "(%1 %2 %3 OR %1 IS NULL) AND ((%1 + %4 %5 %6) OR %7 IS NULL)" ).arg( QgsExpression::quotedColumnRef( mStartFieldName ),
return QStringLiteral( "(%1 %2 %3 OR %1 IS NULL) AND ((%1 + %4 %5 %6) OR %7 IS NULL)" ).arg( dateTimefieldCast( mStartFieldName ),
filterRange.includeEnd() ? QStringLiteral( "<=" ) : QStringLiteral( "<" ),
dateTimeExpressionLiteral( filterRange.end() ),
intervalExpression,
Expand All @@ -556,7 +556,7 @@ QString QgsVectorLayerTemporalProperties::createFilterString( const QgsVectorLay
return QStringLiteral( "(%1 %2 %3 OR %1 IS NULL) AND (%4 %5 %6 OR %4 IS NULL)" ).arg( dateTimefieldCast( mStartFieldName ),
filterRange.includeEnd() ? QStringLiteral( "<=" ) : QStringLiteral( "<" ),
dateTimeExpressionLiteral( filterRange.end() ),
QgsExpression::quotedColumnRef( mEndFieldName ),
dateTimefieldCast( mEndFieldName ),
limitMode() == Qgis::VectorTemporalLimitMode::IncludeBeginIncludeEnd ? QStringLiteral( ">=" ) : QStringLiteral( ">" ),
dateTimeExpressionLiteral( filterRange.begin() ) );

Expand Down

0 comments on commit 8706c7e

Please sign in to comment.