Add support for Device symbol on filters but disable set/unset/isset (#3233)

Currently Device does not work on filters and set/unset/isset fail silently,
with this change Device can be used in filters as standard metadata and
the attempt to use in set/unset/isset reports an appropriate error.
We could enable these operations in the future but they require special casing.
This commit is contained in:
Alejandro Martinez
2019-11-29 14:14:29 -03:00
committed by GitHub
parent 2b291f28b7
commit cc633a7802

View File

@@ -1303,6 +1303,7 @@ void Leaf::validateFilter(Context *context, DataFilterRuntime *df, Leaf *leaf)
!symbol.compare("Today", Qt::CaseInsensitive) ||
!symbol.compare("Current", Qt::CaseInsensitive) ||
!symbol.compare("RECINTSECS", Qt::CaseInsensitive) ||
!symbol.compare("Device", Qt::CaseInsensitive) ||
!symbol.compare("NA", Qt::CaseInsensitive) ||
df->dataSeriesSymbols.contains(symbol) ||
symbol == "isSwim" || symbol == "isRun" || isCoggan(symbol)) {
@@ -2659,6 +2660,10 @@ Result Leaf::eval(DataFilterRuntime *df, Leaf *leaf, float x, RideItem *m, RideF
if (m->ride(false)) lhsdouble = m->ride(false)->recIntSecs();
lhsisNumber = true;
} else if (!symbol.compare("Device", Qt::CaseInsensitive)) {
if (m->ride(false)) lhsstring = m->ride(false)->deviceType();
} else if (!symbol.compare("Current", Qt::CaseInsensitive)) {
if (m->context->currentRideItem())