Fixed null items for longer sensor intervals
This commit is contained in:
parent
78895b2354
commit
7155b98934
1 changed files with 9 additions and 7 deletions
|
|
@ -82,13 +82,15 @@ public class AggregateDataListSqlResult implements SQLResultHandler<ArrayList<Ag
|
||||||
float data = result.getFloat("data"); //the "raw" recorded data
|
float data = result.getFloat("data"); //the "raw" recorded data
|
||||||
float estimatedData = data/confidence; //estimate the "real" value of the data by looking at the confidence value
|
float estimatedData = data/confidence; //estimate the "real" value of the data by looking at the confidence value
|
||||||
|
|
||||||
// Only add nulls if the report interval is smaller than the aggregated interval
|
// Add null data point to list if one or more periods of data is missing before this
|
||||||
if (sensor.getDeviceData() == null ||
|
if (previousTimestampEnd != -1 && sensor.getDeviceData() != null){
|
||||||
timestampEnd-timestampStart > sensor.getDeviceData().getDataInterval()) {
|
boolean shortInterval = timestampEnd-timestampStart < sensor.getDeviceData().getDataInterval();
|
||||||
// Add null data point to list if one or more periods of data is missing before this
|
long distance = timestampStart - (previousTimestampEnd + 1);
|
||||||
if (previousTimestampEnd != -1 && previousTimestampEnd + 1 < timestampStart) {
|
if (// Only add nulls if the report interval is smaller than the aggregated interval
|
||||||
list.add(new AggregateData(id, previousTimestampEnd + 1, null /*Float.NaN*/, username));
|
!shortInterval && distance > 0 ||
|
||||||
}
|
// Only add nulls if space between aggr is larger than sensor report interval
|
||||||
|
shortInterval && distance > sensor.getDeviceData().getDataInterval())
|
||||||
|
list.add(new AggregateData(id, previousTimestampEnd + 1, null /*Float.NaN*/, username));
|
||||||
}
|
}
|
||||||
|
|
||||||
list.add(new AggregateData(id, timestampEnd, (estimatedData/1000f), username)); //add this data point to list
|
list.add(new AggregateData(id, timestampEnd, (estimatedData/1000f), username)); //add this data point to list
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue