Bug fix: use null instead of undefined in html

Former-commit-id: d707c25e7b07c80cd44aef0b806a1536eadebb1b
This commit is contained in:
Daniel Collin 2015-12-08 17:08:39 +01:00
parent 0954e9c0c5
commit 5e98b51287
3 changed files with 5 additions and 5 deletions

View file

@ -50,7 +50,7 @@ public class DataAggregatorDaemon extends TimerTask implements HalDaemon {
try {
stmt = db.getPreparedStatement("SELECT MAX(timestamp_end) FROM sensor_data_aggr WHERE sensor_id == ?");
stmt.setLong(1, sensorId);
Long maxDBTimestamp = DBConnection.exec(stmt, new SimpleSQLHandler<Long>());
Long maxDBTimestamp = DBConnection.exec(stmt, new SimpleSQLResult<Long>());
if(maxDBTimestamp == null)
maxDBTimestamp = 0l;
// 5 minute aggregation
@ -69,7 +69,7 @@ public class DataAggregatorDaemon extends TimerTask implements HalDaemon {
+" WHERE sensor_id == ? AND timestamp_end-timestamp_start == ?");
stmt.setLong(1, sensorId);
stmt.setLong(2, HOUR_IN_MS-1);
maxDBTimestamp = DBConnection.exec(stmt, new SimpleSQLHandler<Long>());
maxDBTimestamp = DBConnection.exec(stmt, new SimpleSQLResult<Long>());
if(maxDBTimestamp == null)
maxDBTimestamp = 0l;
long hourPeriodTimestamp = getTimestampMinutePeriodStart(60, System.currentTimeMillis()-HOUR_AGGREGATION_OFFSET);
@ -87,7 +87,7 @@ public class DataAggregatorDaemon extends TimerTask implements HalDaemon {
stmt = db.getPreparedStatement("SELECT MAX(timestamp_end) FROM sensor_data_aggr WHERE sensor_id == ? AND timestamp_end-timestamp_start == ?");
stmt.setLong(1, sensorId);
stmt.setLong(2, DAY_IN_MS-1);
maxDBTimestamp = DBConnection.exec(stmt, new SimpleSQLHandler<Long>());
maxDBTimestamp = DBConnection.exec(stmt, new SimpleSQLResult<Long>());
if(maxDBTimestamp == null)
maxDBTimestamp = 0l;
long dayPeriodTimestamp = getTimestampHourPeriodStart(24, System.currentTimeMillis()-DAY_AGGREGATION_OFFSET);

View file

@ -116,7 +116,7 @@ public class PCOverviewHttpPage implements HttpPage {
//add null data point to list if one or more periods of data is missing before this
if(previousTimestampEnd != -1 && timestampStart-previousTimestampEnd > periodLength){
list.add(new PowerData(previousTimestampEnd+1, "undefined", username));
list.add(new PowerData(previousTimestampEnd+1, "null", username));
}
//add this data point to list

View file

@ -39,7 +39,7 @@ public class Sensor extends DBBean{
public static long getHighestSequenceId(long sensorId) throws SQLException{
PreparedStatement stmt = HalContext.getDB().getPreparedStatement("SELECT MAX(sequence_id) FROM sensor_data_aggr WHERE sensor_id == ?");
stmt.setLong(1, sensorId);
Integer id = DBConnection.exec(stmt, new SimpleSQLHandler<Integer>());
Integer id = DBConnection.exec(stmt, new SimpleSQLResult<Integer>());
return (id != null ? id+1 : 1);
}