From cc633a7802f7e041e02ca9bad5026779b79c80de Mon Sep 17 00:00:00 2001 From: Alejandro Martinez Date: Fri, 29 Nov 2019 14:14:29 -0300 Subject: [PATCH] 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. --- src/Core/DataFilter.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Core/DataFilter.cpp b/src/Core/DataFilter.cpp index be5343ad5..5d89618c5 100644 --- a/src/Core/DataFilter.cpp +++ b/src/Core/DataFilter.cpp @@ -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())