From 10850ea661a64fdbe9b42ecea53eb0a7a6b0cba5 2017-08-03 08:21:20 From: Alexandre Leroux Date: 2017-08-03 08:21:20 Subject: [PATCH] Updates AMDA result parser to accept NaN values If a value is invalid (for instance not a double), it is converted to NaN. A result line is still invalid if x is invalid (not a date) --- diff --git a/plugins/amda/src/AmdaResultParser.cpp b/plugins/amda/src/AmdaResultParser.cpp index abe18c1..ba5b907 100644 --- a/plugins/amda/src/AmdaResultParser.cpp +++ b/plugins/amda/src/AmdaResultParser.cpp @@ -93,15 +93,23 @@ QPair, QVector > readResults(QTextStream &stream) bool valueOk; auto value = lineData.at(1).toDouble(&valueOk); - // Adds result only if x and value are valid - if (!std::isnan(x) && !std::isnan(value) && valueOk) { + // Adds result only if x is valid. Then, if value is invalid, it is set to NaN + if (!std::isnan(x)) { xData.push_back(x); + + if (!valueOk) { + qCWarning(LOG_AmdaResultParser()) + << QObject::tr( + "Value from line %1 is invalid and will be converted to NaN") + .arg(line); + value = std::numeric_limits::quiet_NaN(); + } + valuesData.push_back(value); } else { qCWarning(LOG_AmdaResultParser()) - << QObject::tr( - "Can't retrieve results from line %1: x and/or value are invalid") + << QObject::tr("Can't retrieve results from line %1: x is invalid") .arg(line); } }