Commit a747cd72 authored by Porter Libby's avatar Porter Libby
Browse files

fix reading subqueries for names

parent 919063d5
......@@ -269,6 +269,7 @@ function getReadings(spot_id,value){
console.info('DATA - readings');
console.info('Loaded ' + readings.length + " data points.");
console.table(readings);
var color = getRandomColor();
query_data = processReadings(readings);
......@@ -619,9 +620,8 @@ function processReadings(readings){
out_node[current_data[j].sensortype] = current_data[j].value_1;
}
}
spots_out.push(out_node);
}
spots_out.push(out_node);
}
return spots_out;
}
......
......@@ -25,6 +25,7 @@ $( document ).ready(function() {
});
});
function createGraphReading(dataset, q_arr, color){
console.log(dataset);
//reset containers
document.getElementById('readingStats').style.display = 'block';
document.getElementById('line-chart').style.display = 'none';
......
......@@ -100,7 +100,10 @@ const getReadingsDates = (request, response) => {
}
const getReadings = (request, response) => {
var query = "SELECT tripid,siteid,sectorid,spotid,platformid,"
+"(SELECT sensortype FROM fieldday_sensor where sensorid=fieldday_reading.sensorid)"
+"(SELECT DISTINCT tripname FROM fieldday_trip where tripid=fieldday_reading.tripid), "
+"(SELECT DISTINCT sitename FROM fieldday_site where siteid=fieldday_reading.siteid AND tripid=fieldday_reading.tripid), "
+"(SELECT DISTINCT sectorname FROM fieldday_sector where sectorid=fieldday_reading.sectorid AND siteid=fieldday_reading.siteid AND tripid=fieldday_reading.tripid), "
+"(SELECT DISTINCT sensortype FROM fieldday_sensor where sensorid=fieldday_reading.sensorid)"
+",recordtime,latitude,longitude,elevation,accuracy,satellites,quality,value_1,value_2"
+",value_3,value_4,value_5,value_6 from fieldday_reading where tripid="+ (request.query.tripid)
+' and siteid='+ (request.query.siteid)
......
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