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

fixes, work toward data fetching

parent c0434ad9
......@@ -222,7 +222,7 @@ function getStreamings(sector_id){
}
console.info('DATA - STREAMINGS');
console.table(response);
//renderStreamings(spotids);
renderStreamings(streamings);
},
error: function(xhr, status, err) {
console.log(xhr.responseText);
......@@ -288,6 +288,19 @@ function renderSpots(spotids){
document.getElementById('data-prompt').innerHTML = "No Spots found for this sector"
}
}
function renderStreamings(streamings){
array_host = [];
for (x = 0; x < streamings.length; x++){
adjusted_time = streamings[x].recordtime.split('T')[0];
array_host.push(streamings[x].hostid);
}
trimmed_array = [...new Set(array)]
console.log(trimmed_array);
}
function onlyUnique(value, index, self) {
return self.indexOf(value) === index;
}
function togglediv(target_div,btn_span){
var btn = document.getElementById(btn_span);
......
......@@ -69,4 +69,7 @@ function createRadioElementSpots( mode, name, checked, label,spotid ) {
radioHtml += '<label for="' + label + '"><strong>Spot #'+ label +'</strong></label></div>';
return radioHtml;
}
function createRadioElementStreamings( mode, name, checked, streaming ) {
}
\ No newline at end of file
......@@ -58,7 +58,7 @@ const getSpots = (request, response) => {
})
}
const getReadings = (request, response) => {
console.info('test');
console.info('SELECT tripid,siteid,sectorid,spotid,platformid,sensorid,recordtime,latitude,longitude,elevation,accuracy,satellites,quality,value,value_2,value_3,value_4,value_5,value_6 from fieldday_reading where tripid='+ (request.query.tripid) +' and siteid='+ (request.query.siteid) +' and sectorid='+ request.query.sectorid + 'and spotid='+ request.query.spotid +';');
pool.query('SELECT tripid,siteid,sectorid,spotid,platformid,sensorid,recordtime,latitude,longitude,elevation,accuracy,satellites,quality,value,value_2,value_3,value_4,value_5,value_6 from fieldday_reading where tripid='+ (request.query.tripid) +' and siteid='+ (request.query.siteid) +' and sectorid='+ request.query.sectorid + 'and spotid='+ request.query.spotid +';', (error, results) => {
if (error) {
throw error
......@@ -67,7 +67,7 @@ const getReadings = (request, response) => {
})
}
const getStreamings = (request, response) => {
console.info('test');
console.info('SELECT tripid,siteid,sectorid,hostid,platformid,sensorid,recordtime,longitude,latitude from fieldday_reading where tripid='+ (request.query.tripid) +' and siteid='+ (request.query.siteid) +' and sectorid='+ request.query.sectorid + ';');
pool.query('SELECT tripid,siteid,sectorid,hostid,platformid,sensorid,recordtime,longitude,latitude from fieldday_reading where tripid='+ (request.query.tripid) +' and siteid='+ (request.query.siteid) +' and sectorid='+ request.query.sectorid + ';', (error, results) => {
if (error) {
throw error
......
......@@ -73,6 +73,7 @@
<div class='data-catagory' id='sites'></div>
<div class='data-catagory' id='sectors'></div>
<div class='data-catagory' id='spots'></div>
<div class='data-catagory' id='streamings'></div>
<div id='data-prompt-box'>
<strong>
<span id='data-prompt'>Pick a trip, site, sector, and spot.</span>
......
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