Fix single/multi select DateTime filter#4495
Conversation
Coverage Report for CI Build 27705649622Warning No base build found for commit Coverage: 59.154%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats
💛 - Coveralls |
📦 Build Artifacts Ready
|
|
I have a bad feeling though that, if the user will use |
📦 Build Artifacts Ready
|
Modified logic to convert convert utc date time
Added constant for timestamp with no milliseconds
bed2d9c to
429d49c
Compare
📦 Build Artifacts Ready
|
tomasMizera
left a comment
There was a problem hiding this comment.
Can we add unit tests here?
Added helper methods to testUtils Changed single/ multi select filter to support IS NULL
📦 Build Artifacts Ready
|
Withalion
left a comment
There was a problem hiding this comment.
The tests look okay in general, let's just improve the approach.
|
|
||
| //! Creates an in-memory layer with a single field of the given type and registers it in QgsProject::instance() | ||
| //! fieldType is the QGIS memory-provider type string: "datetime", "date", "string", "integer", "double", "bool", etc. | ||
| QgsVectorLayer *createFilterTestLayer( const QString &fieldName, | ||
| const QString &fieldType, | ||
| const QString &layerName = QStringLiteral( "FilterTestLayer" ) ); | ||
|
|
||
| //! Appends a single feature to layer via the data provider; value is stored in the named field. Returns false if addFeatures() fails. | ||
| bool addFeatureToLayer( QgsVectorLayer *layer, const QString &fieldName, const QVariant &value ); | ||
|
|
||
| //! Writes a single-filter config into the project and loads it; returns the assigned filterId | ||
| QString setupControllerWithFilter( FilterController *controller, | ||
| FieldFilter::FilterType filterType, | ||
| const QString &layerId, | ||
| const QString &fieldName, | ||
| const QString &sqlExpression ); |
There was a problem hiding this comment.
Instead of doing this in the code create a QGIS project, which will have filters, layers, features already setup. That should also mitigate the filter definition duplication in testfiltercontroller.cpp. Place the project in test/test_data/ and load it before running the tests
Removed the IS NULL change in filter controller Modified the null test cases for filter controller unit tests
📦 Build Artifacts Ready
|
GeoPackage can store DateTime as UTC with or without milliseconds.
The original code assumed that the DateTime entry for Single/Multi select contained milliseconds, which is not always the case if a point is added in QGIS compared to one saved with the mobile app.
Fix: check if the value contains milliseconds and change the format when creating the filter