Commit 5a544c2d authored by Alessio Netti's avatar Alessio Netti

dcdbquery: fixing a sensor operations bug

- Operations based on sensors with custom scaling factors would output
wrong results
parent cc091744
......@@ -141,6 +141,7 @@ void DCDBQuery::genOutput(std::list<DCDB::SensorDataStoreReading> &results, quer
else
std::cout << ts.getString();
int64_t value, result;
/* Print the sensor value */
for (queryMap_t::iterator it=start; it!=stop; it++) {
DCDB::Unit unit;
......@@ -149,8 +150,8 @@ void DCDBQuery::genOutput(std::list<DCDB::SensorDataStoreReading> &results, quer
} else {
unit = baseUnit;
}
int64_t value = (*reading).value;
int64_t result;
value = (*reading).value;
result = 0;
bool resultOk = false;
switch(it->second.operation) {
case DCDB_OP_NONE:
......@@ -198,7 +199,7 @@ void DCDBQuery::genOutput(std::list<DCDB::SensorDataStoreReading> &results, quer
std::cout << ",";
}
}
prevReading = (*reading).value;
prevReading = value;
prevT = ts;
std::cout << std::endl;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment