Fix script bug in stats display

application-manager-new
charithag 10 years ago
parent 10a0881bf9
commit f278ac3266

@ -101,26 +101,22 @@ function getDeviceData(deviceType, deviceId){
} }
function getFireAlarmData(user, device, from, to) { function getFireAlarmData(user, device, from, to) {
if (stats['cpuTemperatureData'] == null){
stats['cpuTemperatureData'] = [];
}
if (stats['temperatureData'] == null){ if (stats['temperatureData'] == null){
stats['temperatureData'] = []; stats['temperatureData'] = [];
} }
if (stats['fanData'] == null){
stats['fanData'] = [];
}
if (stats['bulbData'] == null){
stats['bulbData'] = [];
}
if (stats['sonarData'] == null){ if (stats['sonarData'] == null){
stats['sonarData'] = []; stats['sonarData'] = [];
} }
stats['cpuTemperatureData'].push({"device": device.name, "stats" : getSensorData("DEVICE_CPU_TEMPERATURE_SUMMARY", "TEMPERATURE", user, device.deviceIdentifier, from, to)}); if (stats['motionData'] == null){
stats['motionData'] = [];
}
if (stats['lightData'] == null){
stats['lightData'] = [];
}
stats['temperatureData'].push({"device": device.name, "stats" : getSensorData("DEVICE_TEMPERATURE_SUMMARY", "TEMPERATURE", user, device.deviceIdentifier, from, to)}); stats['temperatureData'].push({"device": device.name, "stats" : getSensorData("DEVICE_TEMPERATURE_SUMMARY", "TEMPERATURE", user, device.deviceIdentifier, from, to)});
stats['fanData'].push({"device": device.name, "stats" : getSensorData("DEVICE_FAN_USAGE_SUMMARY", "status", user, device.deviceIdentifier, from, to)});
stats['bulbData'].push({"device": device.name, "stats" : getSensorData("DEVICE_BULB_USAGE_SUMMARY", "status", user, device.deviceIdentifier, from, to)});
stats['sonarData'].push({"device": device.name, "stats" : getSensorData("SONAR_SENSOR_SUMMARY", "sonar", user, device.deviceIdentifier, from, to)}); stats['sonarData'].push({"device": device.name, "stats" : getSensorData("SONAR_SENSOR_SUMMARY", "sonar", user, device.deviceIdentifier, from, to)});
stats['motionData'].push({"device": device.name, "stats" : getSensorData("PIR_MOTION_SENSOR_SUMMARY", "motion", user, device.deviceIdentifier, from, to)});
stats['lightData'].push({"device": device.name, "stats" : getSensorData("LDR_LIGHT_SENSOR_SUMMARY", "light", user, device.deviceIdentifier, from, to)});
} }
function getSensebotData(user, device, from, to) { function getSensebotData(user, device, from, to) {

@ -315,7 +315,7 @@ function drawLineGraph(graphId, chartDataRaw) {
var chartData = []; var chartData = [];
if (chartDataRaw[i].stats.length > 0) { if (chartDataRaw[i].stats.length > 0) {
for (var j = 0; j < chartDataRaw[i].stats.length; j++) { for (var j = 0; j < chartDataRaw[i].stats.length; j++) {
chartData.push({x: parseInt(chartDataRaw[i].stats[j].x), y: parseInt(chartDataRaw[i].stats[j].y)}); chartData.push({x: parseInt(chartDataRaw[i].stats[j].time), y: parseInt(chartDataRaw[i].stats[j].value)});
} }
graphConfig['series'].push({'color': color[k], 'data': chartData, 'name': chartDataRaw[i].device}); graphConfig['series'].push({'color': color[k], 'data': chartData, 'name': chartDataRaw[i].device});
} }
@ -406,7 +406,7 @@ function drawBarGraph(graphId, chartDataRaw) {
var chartData = []; var chartData = [];
if (chartDataRaw[i].stats.length > 0) { if (chartDataRaw[i].stats.length > 0) {
for (var j = 0; j < chartDataRaw[i].stats.length; j++) { for (var j = 0; j < chartDataRaw[i].stats.length; j++) {
chartData.push({x: parseInt(chartDataRaw[i].stats[j].x), y: parseInt(chartDataRaw[i].stats[j].y)}); chartData.push({x: parseInt(chartDataRaw[i].stats[j].time), y: parseInt(chartDataRaw[i].stats[j].value)});
} }
graphConfig['series'].push({'color': color[k], 'data': chartData, 'name': chartDataRaw[i].device}); graphConfig['series'].push({'color': color[k], 'data': chartData, 'name': chartDataRaw[i].device});
} }

Loading…
Cancel
Save